Withe

From APL Wiki
Revision as of 18:42, 1 September 2021 by Adám Brudzewsky (talk | contribs) (Created page with "{{Built-in|Withe|⍩}} is a primitive operator which forms a hook. Called dyadically with function operands <source lang=apl inline>f</source> and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Withe () is a primitive operator which forms a hook. Called dyadically with function operands f and g, it uses g monadically to pre-processes the right argument before applying f to the given left argument and pre-processed right argument. Called monadically with operands f and g, it uses g monadically to pre-processes the argument before applying f to the argument and pre-processed argument.

In usage, X f⍩g Y is equivalent to X f g Y, and f⍩g Y is equivalent to Y f g Y. Thus, Withe can be defined as the dop {⍺←⍵ ⋄ ⍺ ⍺⍺ ⍵⍵ ⍵} and is equivalent to the derived function f∘g⍨⍨.

Withe first appeared in A Dictionary of APL,[1] but substituted by the 2-train in J after the proposal in Iverson and McDonnell's paper Phrasal Forms.[2]

See also

References


APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
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 axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector