Nice answers Raul, Ric and David. I don't know how I got so confused.
Here's what I put together:
g 5
1 2 3 4 5 4 3 2
g
[: >: [: ((] , -) i.) <:
h 5
1 2 3 4 5 4 3 2
h
[: >: <: (] , -) [: i. <:
i 5
1 2 3 4 5 4 3 2
i
[: >: [: (] (] , -) i.) <:
5!:4 <'g'
-- [:
+- >:
│ -- [:
--+ │ -- ]
│ │ -----+- ,
L----+----+ L- -
│ L- i.
L- <:
5!:4 <'h'
-- [:
+- >:
│ -- <:
--+ │ -- ]
│ +----+- ,
L----+ L- -
│
│ -- [:
L----+- i.
L- <:
5!:4 <'i'
-- [:
+- >:
│ -- [:
--+ │ -- ]
│ │ │ -- ]
L----+----+----+- ,
│ │ L- -
│ L- i.
L- <:
I like the tree for h besst.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Lambert
Sent: Sunday, July 06, 2014 8:34 AM
To: programming
Subject: Re: [Jprogramming] Difference between y and ] in a definition
Along with the other answers, let's specifically observe that
((],-)i.)
is a hook with the two verbs (],-) and i. .
j evaluates the monad integers then the train (],-) as a dyad with the
result of integers as the y argument.
> Date: Sun, 06 Jul 2014 04:52:01 -0400
> From: "Linda Alvord"<[email protected]>
> To:<[email protected]>
> Subject: [Jprogramming] Difference between y and ] in a definition
> Message-ID: <000001cf98f7$8e0574a0$aa105de0$@net>
> Content-Type: text/plain; charset="koi8-r"
>
> Here's something I have not understood for a long time: g is the result
I
> want
>
> H is not the result I want
> g=: 13 :'>: ((],-)i.)<: y'
>
> h=: 13 :'>: ((y,-)i.)<: y'
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm