On Mar 20, 2008, at 5:22 AM, Raul Miller wrote:
3 (({. \:) ([ ,: {) ]) 6 3 9 6 7 5
I'm still puzzled at times by how J operates. Would the ordered
evaluation of this in English be:
1. The whole thing is a dyadic fork which will return (x f y) g (x h y)
f is ({. \:)
g is ([ ,: {)
and
h is ]
2. ] is dyadic and simply returns the right argument, returning 6 3 9
6 7 5
3. ({. \:) is a dyadic hook, which will return x f (g y)
f is {.
g is \:
4. \: is monadic and grades down the right argument, 6 3 9 6 7 5,
returning 2 4 0 3 5 1
5. {. is dyadic and returns the 3 leftmost items of 2 4 0 3 5 1,
returning 2 4 0
Now we have this:
2 4 0 ([ ,: {) 6 3 9 6 7 5
6. 2 4 0 ([ ,: {) 6 3 9 6 7 5 is a dyadic fork operating on the
results of 5 on the left and 2 on the right.
7. 2 4 0 { 6 3 9 6 7 5 is dyadic and returns 9 7 6
8. [ is dyadic and returns the left argument, 2 4 0
Now we have this:
2 4 0 ;: 9 7 6
which returns
2 4 0
9 7 6
phew!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm