Once upon a time, I remember asking Ken Iverson why [paraphrasing
from APL to J] verbs do support more than two arguments. His
response was that you can use a list with as many arguments as
you like.
Anyways, currently J's rank conjunction does not do much of
anything useful when you put arguments together in a list.
Here's a remedy for this issue:
rnk=:2 :0
assert.1=#$y
nounrank=. [EMAIL PROTECTED]&> y
verbrank=. (#y){.n
assert. n =&# y
cellrank=. nounrank <. 0 >. verbrank + nounrank * 0 > verbrank
cells=. cellrank 4 :',<"x y'&.> y
frames=. (-cellrank) (}. $)&.> y
framesizes=. #&> frames
r=. 0#a:
rframe=. frames {::~ (i. >./) framesizes
assert. frames -: framesizes {.&.> <rframe
j=. > ,.&.>/ ,&.> (<rframe) (] $"1 0~ [EMAIL PROTECTED]@] }. [)&.> i.&.> frames
for_k.,i.rframe do.
r=.r,< u (k{j) {&> cells
end.
>rframe$r
)
Example use:
,&.>/ rnk 1 0 1 <"1 i.3 3
+-------------+-------------+-------------+
|0 1 2 3 6 7 8|0 1 2 4 6 7 8|0 1 2 5 6 7 8|
+-------------+-------------+-------------+
,&.>/ rnk 2 0 0 <"2 i.3 2 2
+----+----+
|0 1 |0 1 |
|2 3 |2 3 |
|4 8 |5 9 |
+----+----+
|0 1|0 1|
|2 3|2 3|
|6 10|7 11|
+----+----+
More generally, rnk's left arg is a verb which takes a boxed list
of arguments. And, rnk's right (conjunction) arg is the ranks
to be used against each of those boxed arguments.
Let me know if you find this useful.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm