It seems so,
Y=. i.3 4
Y
0 1 2 3
4 5 6 7
8 9 10 11
+:`*:`-: ((>@[ apply ])"0) Y
0 2 4 6
16 25 36 49
4 4.5 5 5.5
Just be aware that the construction works only with gerunds formed by
primitives or proverbs,
+:`*:`(2&%~) ((>@[ apply ])"0) Y
|domain error: apply
| +:`*:`(2&%~) ((>@[apply])"0)Y
half=. %&2
half=. %&2
+:`*:`half ((>@[ apply ])"0) Y
0 2 4 6
16 25 36 49
4 4.5 5 5.5
Alternatively, you can use a list of strings,
('+:';'*:';'%&2') ((>@[ apply ])"0) Y
0 2 4 6
16 25 36 49
4 4.5 5 5.5
________________________________
From: Steven Taylor <[email protected]>
To: Programming forum <[email protected]>
Sent: Friday, January 30, 2009 12:24:24 PM
Subject: Re: [Jprogramming] gerrunds
+:`*:`-: ((>@[ apply ])"0) 1 2 3
2 4 1.5
or
+:`*:`-: ( apply &.>) 1 2 3
+-+-+---+
|*2|4|1.5|*+-+-+---+
I was trying to get the first, but perhaps I need to get more
acquainted with box as intuitively this looks to be more appropriate.
In the first example, could each atom be a list which would lead to
the result being a table?
Thanks,
Steven
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm