Pair: Difference between revisions
Jump to navigation
Jump to search
(Add BQN) |
(Remove Over workaround: Over's now supported in many APLs) |
||
Line 1: | Line 1: | ||
{{Built-in|Pair|⍮}} or '''Juxtapose''' is a [[primitive function]] equivalent to the [[dfn]] <syntaxhighlight lang=apl inline>{⍺←,⊂ ⋄ ⍺ ⍵}</syntaxhighlight> which aids in constructing nested arrays during [[tacit programming]] where [[stranding]] by juxtaposition is not available. It is also equivalent to the [[catenate|catenation]] of the [[enclose]]d arguments | {{Built-in|Pair|⍮}} or '''Juxtapose''' is a [[primitive function]] equivalent to the [[dfn]] <syntaxhighlight lang=apl inline>{⍺←,⊂ ⋄ ⍺ ⍵}</syntaxhighlight> which aids in constructing nested arrays during [[tacit programming]] where [[stranding]] by juxtaposition is not available. It is also equivalent to the [[catenate|catenation]] of the [[enclose]]d arguments, written <syntaxhighlight lang=apl inline>,⍥⊂</syntaxhighlight> using [[Over]]<ref>[https://www.jsoftware.com/papers/satn41.htm "Composition and Enclosure"] § | ||
Composition Operators. SATN-41, 1981-06-20.</ref> | Composition Operators. SATN-41, 1981-06-20.</ref>. It was introduced in [[Extended Dyalog APL]], and then adopted into [[dzaima/APL]]. It was added to [[BQN]] with the glyph <code>⋈</code> in 2021. | ||
== Common usage == | == Common usage == |
Revision as of 14:22, 14 June 2023
⍮
|
Pair (⍮
) or Juxtapose is a primitive function equivalent to the dfn {⍺←,⊂ ⋄ ⍺ ⍵}
which aids in constructing nested arrays during tacit programming where stranding by juxtaposition is not available. It is also equivalent to the catenation of the enclosed arguments, written ,⍥⊂
using Over[1]. It was introduced in Extended Dyalog APL, and then adopted into dzaima/APL. It was added to BQN with the glyph ⋈
in 2021.
Common usage
Its plain usage is in pairing up two parallel values:
6 7 8(+⍮-)3 ┌───────┬─────┐ │9 10 11│3 4 5│ └───────┴─────┘
Works in: dzaima/APL, Extended Dyalog APL
It can also be combined with Mix to increase rank rather than depth:
6 7 8(+↑⍤⍮-)3 9 10 11 3 4 5
Works in: dzaima/APL, Extended Dyalog APL
External links
Documentation
- BQN (as
⋈
)
See also
References
- ↑ "Composition and Enclosure" § Composition Operators. SATN-41, 1981-06-20.