Index Generator: Difference between revisions
From NARS2000
Jump to navigationJump to search
Sudleyplace (talk | contribs) (New page: <ul> <li><p>Monadic iota (<apll>⍳R</apll>) is extended to negative right arguments, returning a vector of length <apll>|R</apll> whose values complement on the left the corresponding v...) |
Sudleyplace (talk | contribs) No edit summary |
||
Line 42: | Line 42: | ||
<p>This extension is implemented via an internal magic function due to Carl M. Cheney:</p> | <p>This extension is implemented via an internal magic function due to Carl M. Cheney:</p> | ||
<apll> ∇ | <apll> ∇ Z←#MonIota V</apll><br /> | ||
<apll>[1] Z←⊃∘.,/⍳¨V</apll><br /> | <apll>[1] Z←⊃∘.,/⍳¨V</apll><br /> | ||
<apll> ∇</apll></li> | <apll> ∇</apll></li> | ||
</ul> | </ul> |
Revision as of 21:34, 10 April 2008
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