Hi All,

Here's an interesting behaviour I came across while trying to implement a J
interpreter - the behaviour of nested ranks.  It turns out that using "
actually does not modify the rank of the underlying verb but adds another
wrapper in how it is applied.

Note that (1) and (2) below produce different results.

box2 provides an easier way to visualize what arguments a verb is applied
to.

Mike

---

   ] y=:2 2 $ 0 1 100 0
  0 1
100 0
   ] z =: 2 2 2 $ 1+i. 100
1 2
3 4

5 6
7 8
   y *"1 2 z NB. (1)
  0   0
  3   4

500 600
  0   0
   y (*"1 1)"1 2 z NB. (2)
  0 2
  0 4

500 0
700 0
   box2=: (<@:[),(<@:])
   y box2"1 2 z
+-----+---+
|0 1  |1 2|
|     |3 4|
+-----+---+
|100 0|5 6|
|     |7 8|
+-----+---+
   y (box2"1 1)"1 2 z
+-----+---+
|0 1  |1 2|
+-----+---+
|0 1  |3 4|
+-----+---+

+-----+---+
|100 0|5 6|
+-----+---+
|100 0|7 8|
+-----+---+
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to