On 6/8/07, Sherlock, Ric <[EMAIL PROTECTED]> wrote:
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Raul Miller
> First off, observe that you can group things the way you want
> using a /. dyad:
> Now we just need a verb to rearrange things the way you want.
>    spread=:4 :'x`:6 y'"0 _1
>    ({."1 {.`<`{.&spread@|:/. ])raw
...
but I don't really understand what exactly spread is doing. I'd really
appreciate a more detailed explanation if you're willing.

The verb spread applies gerunds (left arg) to items (right arg)

  +:`<: spread 3 4
6 3

It's a dyad (4 :''), the dyad applies a gerund to its right arg (x`:6 y)
and atoms from the left arg get applied to items from the right ("0 _1)

Thus {.`<`{.&spread will take the first element of the first item
of the right argument, will box the second element of the right
argument and will take the first element of the third item of the
right argument.  And, with transpose (|:), items of the right argument
correspond to columns of the selected rows.

Good enough?  Or is there something I should cover in greater
depth?

Thanks,

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

Reply via email to