Table: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
== Examples == | == Examples == | ||
For arrays of [[rank]] 1 or higher, the result is identical to applying Ravel to major cells | For arrays of [[rank]] 1 or higher, the result is identical to applying Ravel to major cells: | ||
<source lang=apl> | <source lang=apl> | ||
Line 49: | Line 49: | ||
YZABCDEFGHIJKLMNOPQRSTUV | YZABCDEFGHIJKLMNOPQRSTUV | ||
{⍵⍴⍨(1↑⍴⍵),(×/1↓⍴⍵)}2 3 4 2⍴⎕A | {⍵⍴⍨(1↑⍴⍵),(×/1↓⍴⍵)}2 3 4 2⍴⎕A | ||
ABCDEFGHIJKLMNOPQRSTUVWX | |||
YZABCDEFGHIJKLMNOPQRSTUV | |||
</source> | |||
In languages where the [[Rank (operator)|Rank operator]] is available, Table is equivalent to <source lang=apl inline>,⍤¯1</source>: | |||
<source lang=apl> | |||
(,⍤¯1)2 3 4 2⍴⎕A | |||
ABCDEFGHIJKLMNOPQRSTUVWX | |||
YZABCDEFGHIJKLMNOPQRSTUV | |||
</source> | |||
In languages where [function axis] is available, Table is equivalent to <source lang=apl inline>,[1↓⍳≢⍴Y]</source>: | |||
<source lang=apl> | |||
{,[1↓⍳≢⍴⍵]⍵}2 3 4 2⍴⎕A | |||
ABCDEFGHIJKLMNOPQRSTUVWX | ABCDEFGHIJKLMNOPQRSTUVWX | ||
YZABCDEFGHIJKLMNOPQRSTUV | YZABCDEFGHIJKLMNOPQRSTUV |