Replicate: Difference between revisions

Jump to navigation Jump to search
331 bytes added ,  10:38, 18 March 2020
→‎High-rank arrays: APL2-style shape extension
(→‎Examples: Add APL2-style negative extension and reorganize)
(→‎High-rank arrays: APL2-style shape extension)
Line 49: Line 49:


=== High-rank arrays ===
=== High-rank arrays ===
Replicate works along a particular axis, which can be specified in languages with [[function axis]] and otherwise is the first axis for <source lang=apl inline>⌿</source>, and the last axis for <source lang=apl inline>/</source> (except in [[A+]], which uses <source lang=apl inline>/</source> for the [[Leading axis theory|first-axis]] form and has no last-axis form, and [[dzaima/APL]], which is similar but uses <source lang=apl inline>⌿</source>).
Replicate works along a particular [[axis]], which can be specified in languages with [[function axis]] and otherwise is the first axis for <source lang=apl inline>⌿</source>, and the last axis for <source lang=apl inline>/</source> (except in [[A+]], which uses <source lang=apl inline>/</source> for the [[Leading axis theory|first-axis]] form and has no last-axis form, and [[dzaima/APL]], which is similar but uses <source lang=apl inline>⌿</source>).
<source lang=apl>
<source lang=apl>
       ⊢A ← 4 6⍴⎕A
       ⊢A ← 4 6⍴⎕A
Line 67: Line 67:
STUVWX
STUVWX
</source>
</source>
[[APL2]] further extends the [[singleton extension]] of the right argument, allowing it to have length 1 along the replication axis even if other axes have lengths not equal to 1.
<source lang=apl>
      1 ¯2 3 / ⍪'abc'
a  aaa
b  bbb
c  ccc
</source>{{Works in|[[APL2]], [[Dyalog APL]], [[APLX]], [[ngn/APL]], [[GNU APL]]}}


== History ==
== History ==

Navigation menu