Pair: Difference between revisions

Jump to navigation Jump to search
Rearrange; include name "Half Pair"
(More explicit description of the monadic case)
(Rearrange; include name "Half Pair")
Line 1: Line 1:
{{Built-in|Pair|⍮}} or '''Juxtapose''' is a [[primitive]] [[ambivalent function]] that constructs a [[vector]] of its [[argument]]s. It can be implemented as the [[dfn]] <syntaxhighlight lang=apl inline>{⍺←,⊂ ⋄ ⍺ ⍵}</syntaxhighlight>, or 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> Pair aids in constructing nested arrays in [[tacit programming]], where [[stranding]] by juxtaposition is not available. It was introduced in [[Extended Dyalog APL]] in 2018, and then adopted into [[dzaima/APL]]. It was added to [[BQN]] with the glyph <code>⋈</code> in 2021. The [[monadic]] case, which is similar to [[Enclose]] except that it gives a result of [[rank]] 1 rather than 0, is called '''Enlist''' in BQN, as well as [[K]], where it is the monadic case of <code>,</code> (K has no dyadic Pair primitive).
{{Built-in|Pair|⍮}} or '''Juxtapose''' is a [[primitive]] [[ambivalent function]] that constructs a [[vector]] of its [[argument]]s, present in [[Extended Dyalog APL]], [[dzaima/APL]], and [[BQN]] (as <code>⋈</code>). The [[monadic]] case is referred to as '''Half Pair''' in Extended Dyalog APL, and is similar to [[Enclose]] except that it gives a result of [[rank]] 1 rather than 0. This case is called '''Enlist''' in BQN, as well as [[K]], where it is the monadic case of <code>,</code> (K has no dyadic Pair primitive). Dyadic Pair is similar to the [[Link]] primitive in [[SHARP APL]] and [[J]], but Link has an asymmetric definition that adds its left argument to a vector right argument rather than creating a new vector.
 
Pair can be implemented as the [[dfn]] <syntaxhighlight lang=apl inline>{⍺←,⊂ ⋄ ⍺ ⍵}</syntaxhighlight>, or 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> Pair aids in constructing nested arrays in [[tacit programming]], where [[stranding]] by juxtaposition is not available.


== Common usage ==
== Common usage ==
Line 23: Line 25:
{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}
{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}


== External links ==
== History ==


=== Documentation ===
Pair was defined as <syntaxhighlight lang=apl inline>⍮</syntaxhighlight> in [[Extended Dyalog APL]] in 2018, and then adopted into [[dzaima/APL]]. It was added to [[BQN]] with the glyph <code>⋈</code> in 2021.
 
== Documentation ==


* [https://mlochbaum.github.io/BQN/doc/pair.html BQN] (as <code>⋈</code>)
* [https://mlochbaum.github.io/BQN/doc/pair.html BQN] (as <code>⋈</code>)
== See also ==
* [[Link]]


== References ==
== References ==
<references />
<references />
{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu