Table: Difference between revisions

Jump to navigation Jump to search
364 bytes added ,  14:25, 14 July 2020
m
Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com"
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com")
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
== Examples ==
== Examples ==


For arrays of [[rank]] 1 or higher, the result is identical to applying Ravel to major cells. In languages where [[Rank (operator)|Rank operator]] is available, Table is equivalent to <source lang=apl inline>,⍤¯1</source>.
For arrays of [[rank]] 1 or higher, the result is identical to applying Ravel to major cells:


<source lang=apl>
<source lang=apl>
Line 40: Line 40:
Table preserves the array's [[Tally]] (the number of major cells).
Table preserves the array's [[Tally]] (the number of major cells).


Table is equivalent to [[reshape|reshaping]] with the shape where all trailing axis lengths have been replaced by their [[product], or alternatively, the tally concatenated to the [[bound]] divided by the tally:
Table is equivalent to [[reshape|reshaping]] with the shape where all trailing axis lengths have been replaced by their [[product]] or, alternatively, the tally concatenated to the [[bound]] divided by the tally:
<source lang=apl>
<source lang=apl>
       ⍪2 3 4 2⍴⎕A
       ⍪2 3 4 2⍴⎕A
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
Line 61: Line 74:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Enlist.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Enlist.htm Dyalog]
* J [https://www.jsoftware.com/help/dictionary/d321.htm Vocabulary], [https://code.jsoftware.com/wiki/Vocabulary/commadot NuVoc]
* J [https://www.jsoftware.com/help/dictionary/d321.htm Vocabulary], [https://code.jsoftware.com/wiki/Vocabulary/commadot NuVoc]


{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu