"Raul Miller" <[EMAIL PROTECTED]> wrote:
> If fork is implemented as an adverb which produces
> an adverb which produces an adverb which produces
> an ambivalent verb, I believe no parenthesis are needed.
>
> In other words, instead of writing
>    (f +g +h + v)
> you would be able to write
>    f + g + h + v F:F:F:
>
> For example:
> serialV=:1 :0
>   lin=.3!:1]5!:1<'u'
>   '((3!:2]',(5!:5<'lin'),')5!:0)'
> )
>
> F=:1 :0
>  1 :('Z1=:1 :((''(u y)'',(u serialV),''(',(u serialV),'
> y)'');'':'';''(x u y)'',(u serialV),''(x ',(u serialV),' y)'')')
> )
>
>    0:,1:,2:,3:F F F ''
> 0 1 2 3
>    *:, -:, %:,: +: F F F i.4
> 0   1       4       9
> 0 0.5       1     1.5
> 0   1 1.41421 1.73205
> 0   2       4       6
>
> Note that this rather simplistic implementation does not automatically
> promote nouns to constant verbs, but that could be added if anyone
> thought this approach was worthwhile.

I wrote something like this about a month ago (and my version
does allow f to be a noun (and also g and/or h, which would be nice,
but not compatible with current train syntax).

A simplified version (without that):
   fork2 =: 2 : ('(u y)[EMAIL PROTECTED] [EMAIL PROTECTED] y';':';'(x u 
y)[EMAIL PROTECTED] x [EMAIL PROTECTED] y')
   fork1 =: 2 : 'fork2(u`v)'
   fork =: 1 : 'fork1 u'
   +/ % # fork 1 2 3 6
3

(As Dan Bron mentions, this syntax does NOT eliminate the aesthetic
of "train syntax", but it DOES remove the necessity for the parser
to be able to parse forks as a special rule.)

-- Mark D. Niemiec <[EMAIL PROTECTED]>

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

Reply via email to