Index Generator

From NARS2000
Revision as of 15:16, 10 April 2008 by 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  • 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←F V
    [1]   Z←⊃∘.,/⍳¨V

        ∇