trusted
183
edits
(Created page with "{{Built-in|Decode|⊥}}, also called '''Base''', is a dyadic primitive function which evaluates the right argument in terms of the radix system defined by the left...") |
No edit summary |
||
Line 77: | Line 77: | ||
⊥⍨1 1 0 1 1 1 | ⊥⍨1 1 0 1 1 1 | ||
3 | 3 | ||
</source> | |||
Decode has an important property with array [[index]]: Given an arbitrary array A with [[shape]] S, the index of an [[element]] in A can be decoded with S to obtain the corresponding index in the [[ravel]] of A. Decoding all indices given by [[Index Generator]] shows the ravel order of the elements of an array with the given shape. Note that <source lang=apl inline>⎕IO←0</source> is required for this to hold. | |||
<source lang=apl> | |||
⎕IO←0 | |||
M←2 3 4⍴⎕A | |||
M[1;0;2]=(,M)[2 3 4⊥1 0 2] | |||
1 | |||
2 3 4∘⊥¨⍳2 3 4 | |||
0 1 2 3 | |||
4 5 6 7 | |||
8 9 10 11 | |||
12 13 14 15 | |||
16 17 18 19 | |||
20 21 22 23 | |||
</source> | </source> | ||