Bind: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - "<source" to "<syntaxhighlight")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Built-in|Bind|∘}} is a [[primitive operator]]. It shares the glyph [[Jot]] (<syntaxhighlight lang=apl inline>∘</source>) with [[Beside]]; in many dialects the two operators share the name [[Compose]]. <syntaxhighlight lang=apl inline>∘</source> means Bind if any [[operand]] is an [[array]]. Its [[derived function]]s can only be called monadically.
{{Built-in|Bind|∘}} is a [[primitive operator]]. It shares the glyph [[Jot]] (<syntaxhighlight lang=apl inline>∘</syntaxhighlight>) with [[Beside]]; in many dialects the two operators share the name [[Compose]]. <syntaxhighlight lang=apl inline>∘</syntaxhighlight> means Bind if any [[operand]] is an [[array]]. Its [[derived function]]s can only be called monadically.


Called with an array left operand <syntaxhighlight lang=apl inline>A</source> and function right operand <syntaxhighlight lang=apl inline>g</source>, <syntaxhighlight lang=apl inline>(A∘g) X</source> is equivalent to <syntaxhighlight lang=apl inline>A g X</source>.
Called with an array left operand <syntaxhighlight lang=apl inline>A</syntaxhighlight> and function right operand <syntaxhighlight lang=apl inline>g</syntaxhighlight>, <syntaxhighlight lang=apl inline>(A∘g) X</syntaxhighlight> is equivalent to <syntaxhighlight lang=apl inline>A g X</syntaxhighlight>.


Called with a function left operand <syntaxhighlight lang=apl inline>f</source> and array right operand <syntaxhighlight lang=apl inline>B</source>, <syntaxhighlight lang=apl inline>(f∘B) X</source> is equivalent to <syntaxhighlight lang=apl inline>X f B</source>.
Called with a function left operand <syntaxhighlight lang=apl inline>f</syntaxhighlight> and array right operand <syntaxhighlight lang=apl inline>B</syntaxhighlight>, <syntaxhighlight lang=apl inline>(f∘B) X</syntaxhighlight> is equivalent to <syntaxhighlight lang=apl inline>X f B</syntaxhighlight>.


== Common usage ==
== Common usage ==
Line 11: Line 11:
       Inc 1 2 3
       Inc 1 2 3
2 3 4
2 3 4
</source>
</syntaxhighlight>


== External links ==
== External links ==
Line 19: Line 19:


=== Documentation ===
=== Documentation ===
* [https://help.dyalog.com/18.0/#Language/Primitive%20Operators/Bind.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Operators/Bind.htm Dyalog]
* [https://mlochbaum.github.io/BQN/doc/hook.html BQN] (uses [[hook]])
* [https://mlochbaum.github.io/BQN/doc/hook.html BQN] (uses [[hook]])




{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]

Latest revision as of 10:57, 6 October 2022

Bind () is a primitive operator. It shares the glyph Jot () with Beside; in many dialects the two operators share the name Compose. means Bind if any operand is an array. Its derived functions can only be called monadically.

Called with an array left operand A and function right operand g, (A∘g) X is equivalent to A g X.

Called with a function left operand f and array right operand B, (f∘B) X is equivalent to X f B.

Common usage

Bind is used to create a derived function with a single constant argument, particularly in tacit programming:

Try it online!

      Inc←+∘1
      Inc 1 2 3
2 3 4

External links

Lessons

Documentation


APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector