From APL Wiki
Revision as of 22:09, 10 September 2022 by Adám Brudzewsky (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
Jump to navigation Jump to search

Pair () or Juxtapose is a primitive function equivalent to the dfn <source 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 catenation of the enclosed arguments; <source lang=apl inline>,⍥⊂</syntaxhighlight> using the Over operator[1] or <source lang=apl inline>,⍨∘⊂⍨∘⊂</syntaxhighlight> using only the traditional operators Commute and Compose. It was introduced in Extended Dyalog APL, and then adopted into dzaima/APL.

Common usage

Its plain usage is in pairing up two parallel values:

Try it online! <source lang=apl>

     6 7 8(+⍮-)3

┌───────┬─────┐ │9 10 11│3 4 5│ └───────┴─────┘ </syntaxhighlight>

It can also be combined with Mix to increase rank rather than depth:

Try it online! <source lang=apl>

     6 7 8(+↑⍤⍮-)3

9 10 11 3 4 5 </syntaxhighlight>

See also


  1. "Composition and Enclosure" § Composition Operators. SATN-41, 1981-06-20.
APL built-ins [edit]
Primitive functions
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Name classCase convertUnicode convert
Operators SearchReplace