Index Generator
From NARS2000
Monadic iota (⍳R) is extended to negative right arguments, returning a vector of length |R whose values complement on the left the corresponding values from ⍳|R.
For example, in origin-0
⍳3
0 1 2⍳¯3
¯3 ¯2 ¯1and in origin-1
⍳3
1 2 3⍳¯3
¯2 ¯1 0
Monadic iota (⍳R) is extended to length > 1 vector right arguments, returning a nested array of shape R whose items are each integer vectors of length ⍴⍴R.
For example, in origin-0
⍳2 3
0 0 0 1 0 2
1 0 1 1 1 2⍳2 ¯3
0 ¯3 0 ¯2 0 ¯1
1 ¯3 1 ¯2 1 ¯1and in origin-1
⍳2 3
1 1 1 2 1 3
2 1 2 2 2 3⍳2 ¯3
1 ¯2 1 ¯1 1 0
2 ¯2 2 ¯1 2 0This extension is implemented via an internal magic function due to Carl M. Cheney:
∇ Z←#MonIota V
∇
[1] Z←⊃∘.,/⍳¨V