Question 1) 5!:6 can parenthesize trains, nouns, adverbs, and verbs.

   5!:6@:<'hook'
((0;(3 4 2$0);(0$0);0 _1 0 _1)&;:) (7 (+~) +)

(+~) is a verb.  (Recent email shows you slept through this.)

(7 (+~) +)   is a fork.  Trains are more complicated than the 6 parts of
speech, remembering punctuation and copula.

7 , equivalently here as 7"_ , I call a verb.

Leaving the nested parenthesized nouns you've already noted may be
parenthesized.


   Adverb=: ([`)(`:6)

   5!:6@:<'Adverb'
([`)(`:6)

These are parenthesized adverbs, being "partially fulfilled"
conjunctions.


Question 3) The adverb F may help answer your valence question:

embed=: >@{.@[ , ] , >@{:@[
assert '(*)' -: '()' embed '*'
assert 1 0 _ 8 1 2 -: (1 0 ; 8 1 2) embed _

F=: 1 : 0
M=. 'm ' (embed ":) m
'()' embed M embed~ '' ; ": y
:
D=. (' d' ; ' ') (embed ":) m
'()' embed (x ;&": y) embed D
)

'X Y'=: 'XY'

assert '((m1 X) d0 Y)'      -:  X (0 F~  1 F)~ Y
assert '(m0 (m1 Y))'        -:  (0 F)&(1 F) Y
assert '((m1 X) d0 (m1 Y))' -:  X (0 F)&(1 F) Y


Fri, 20 Jul 2012 05:05:51 +0100
> From: Ian Clark <[email protected]>
> To: Programming forum <[email protected]>
> Subject: [Jprogramming] fully parenthesized representation of a tacit
>         verb
> Message-ID:
>         <CAB2g=gALQ2c+b1d6AKyrW-3XsdP
> [email protected]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> For all my exposure to J, I can't answer the following simple(?)
> questions. Can someone help please?
> 
> Take the fully parenthesized representation of a given tacit verb: foo
> (viz 5!:6 <'foo')
> --note: "verb", not "sentence" (which might be a noun).
> Take what's inside any pair of balanced parens: (...). Give it a name:
> baa, so we can formally replace (...) with (baa) .
> 
> 1. Is baa always a verb?
>      Answer: no, because I can make phrases like: (-~) appear.
>     BUT are there only a small number of special cases I can detect
> and allow for, like (-~)?
> 
> 2. If baa is not a verb, how can I determine its type?
>     -short of actually assigning it to a local name: baa=. (...) and
> calling 4!:0<'baa' ?
> 
> 3. Is there an easy way to tell if baa gets called monadically or
> dyadically, and if it gets the y-argument of foo -- and the x-arg too?
>     Ignore the case of baa getting an intermediate noun -- I can
> determine this from the paren nesting structure.
>     Ditto a constant 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to