Reverse: Difference between revisions

Jump to navigation Jump to search
149 bytes added ,  13:19, 30 May 2021
mNo edit summary
(→‎Documentation: BQN link)
(6 intermediate revisions by 3 users not shown)
Line 28: Line 28:
Reverse with a [[specified axis]] can reverse along any of the three dimensions of the array below.
Reverse with a [[specified axis]] can reverse along any of the three dimensions of the array below.
<source lang=apl>
<source lang=apl>
       ⊢a←2 3 6⍴⍳36
       ⎕←a←2 3 6⍴⍳36
  1  2  3  4  5  6
  1  2  3  4  5  6
  7  8  9 10 11 12
  7  8  9 10 11 12
Line 99: Line 99:
     ⍺ ← ¯1+≢⍴⍵                  ⍝ Assume last axis
     ⍺ ← ¯1+≢⍴⍵                  ⍝ Assume last axis
     l ← ⍺ ⌷ ⍴⍵                  ⍝ Length of reversed axis
     l ← ⍺ ⌷ ⍴⍵                  ⍝ Length of reversed axis
     (l-1+⍳l) ⌷[⍺] ⍵             ⍝ Reverse with indexing
     (⊂l-1+⍳l) ⌷[⍺] ⍵           ⍝ Reverse with indexing
}
}
</source>
</source>
Line 111: Line 111:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Reverse.htm Dyalog]
* [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Reverse.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_510.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_510.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d231.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/bardot NuVoc] (only first-axis reverse exists)
* J [https://www.jsoftware.com/help/dictionary/d231.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/bardot NuVoc] (only first-axis reverse exists)
* [https://mlochbaum.github.io/BQN/doc/reverse.html BQN]


{{APL built-ins}}
{{APL built-ins}}[[Category:Primitive functions]][[Category:Functions with first- and last-axis forms]]

Navigation menu