Index Generator: Difference between revisions

From NARS2000
Jump to navigationJump to search
(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...)
 
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>&nbsp;&nbsp;&nbsp;&nbsp;∇&nbsp;Z←F V</apll><br />
<apll>&nbsp;&nbsp;&nbsp;&nbsp;∇&nbsp;Z←#MonIota V</apll><br />
<apll>[1]&nbsp;&nbsp;&nbsp;Z←⊃∘.,/⍳¨V</apll><br />
<apll>[1]&nbsp;&nbsp;&nbsp;Z←⊃∘.,/⍳¨V</apll><br />
<apll>&nbsp;&nbsp;&nbsp;&nbsp;∇</apll></li>
<apll>&nbsp;&nbsp;&nbsp;&nbsp;∇</apll></li>
</ul>
</ul>

Revision as of 02:34, 11 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 ¯1

    and 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 ¯1

    and 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 0

    This extension is implemented via an internal magic function due to Carl M. Cheney:

        ∇ Z←#MonIota V
    [1]   Z←⊃∘.,/⍳¨V

        ∇