Boyko,
Yes, you have identified a key missing construct that has bothered me
for quite some time. I wish there were a simple way to implement such
a left-leaning hook in the parsing table, but that does not seem
practical. I bet a Henry Rich style conjunction in the spirit of his
lex would accomplish a similar but less beautiful result (I cannot
find a direct reference to lex and Henry, so I may be wrong about
Henry defining lex).
The excerpt below shows some alternative ways of computing oo. I am
most interested in oo4 and oo5; the latter uses lex and begs for a
renaming of left-leaning hook.
oo=: ({...@[<]) *. ({:@[>])
f =: <
g =: <
oo1=: ({...@[ f ]) *. ({:@[ g~ ])
2 3 oo 2.0 2.1 2.9 3
0 1 1 0
2 3 oo1 2.0 2.1 2.9 3
0 1 1 0
oo2=: (] f~ {...@[) *. (] g {:@[)
2 3 oo2 2.0 2.1 2.9 3
0 1 1 0
oo3=: ( f~ {...@[) *. ( g {:@[)
2 3 oo3~ 2.0 2.1 2.9 3
0 1 1 0
oo4=: ( f~ {.) *. ( g {:)
2 3 oo4~ 2.0 2.1 2.9 3
0 1 1 0
lex =: 2 : 'u...@[` v` ] `:6'
{. lex (g~)
{...@[ g~ ]
2 3 ({. lex f*. {:lex (g~)) 2.0 2.1 2.9 3
0 1 1 0
oo5=: {. lex f*. {:lex (g~)
2 3 oo5 2.0 2.1 2.9 3
0 1 1 0
While I have been trying to find a lex reference in the archives of
the forum, Roger has replied to the original thread. Roger's LH may be
identical, but I am not sure.
---------- Forwarded message ----------
From: Boyko Bantchev <[email protected]>
Date: 2009/10/30
Subject: Re: [Jprogramming] x � [y1,y2)
To: Programming forum <[email protected]>
2009/10/30 Roger Hui <[email protected]>:
> ...
> Because I prefer to have the interval end points
> as the left argument.
>
> In APL/J, it is generally the case that
> the left and right arguments are so defined
> that x&f makes a more sensible monad
> than f&y . The n v1 v2 fork accentuates
> this point.
I understand now what you mean, thanks for explaining.
(The formulations in phrases/intervals are in the other
direction.)
Now, I am curious about the following. With expressions like
the above, where some verbosity is apparent, one feels like using
a ‘left-leaning’ hook which J doesn't have. Has such a device
been considered? Perhaps found not frequently occurring?
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm