Over: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{Built-in|Over|<nowiki></nowiki>}} is a [[dyadic operator]] which takes two [[function]]s and produce a [[function]] (<source lang=apl inline>⍥</source>).
{{Built-in|Over|⍥}} is a [[primitive operator|primitive]] [[dyadic operator]] which takes two [[function]] [[operand]]s and produces a [[derived function]] which pre-processes the argument(s) using the monadic right operand, before applying the left operand on/between the result(s).


== Explanation ==
== Explanation ==
When the resulting function is used [[monadic]]ally, it is the same as [[Atop]].
When the resulting function is used [[monadic]]ally, it has the same behaviour as if the [[Beside]] or [[Atop operator]] had been used:
{|
{|
|<source lang=apl>  (g ⍥ h) ⍵</source>|| {{←→}} ||<source lang=apl>g (h ⍵)</source>
|<source lang=apl>  (g ⍥ h) ⍵</source>|| {{←→}} ||<source lang=apl>g (h ⍵)</source>
|}
|}
When the resulting function is used [[dyadic]]ally, then it forms an [[Over]] expression (which is the true purpose of this operator).
When the resulting function is used [[dyadic]]ally, both arguments are pre-processed:
{|
{|
|<source lang=apl>⍺ (g ⍥ h) ⍵</source>|| {{←→}} ||<source lang=apl>(h ⍺) g (h ⍵)</source>
|<source lang=apl>⍺ (g ⍥ h) ⍵</source>|| {{←→}} ||<source lang=apl>(h ⍺) g (h ⍵)</source>
Line 13: Line 13:
== Examples ==
== Examples ==
<source lang=apl>
<source lang=apl>
       x←1 2 3
       x←3 1 2
       y←4 5 6
       y←4 6 5
    x +⍥(⌈/) y ⍝ add the max of x and max of y
      x +⍥(⌈/) y ⍝ add the max of x and max of y
9
9
       ⍝ same as
       ⍝ same as
Line 21: Line 21:
9
9
</source>
</source>
== External links ==
=== Lessons ===
* [https://chat.stackexchange.com/rooms/52405/conversation/lesson-47-atop--and-over-#55084108 APL Cultivation]
=== Documentation ===
* [https://help.dyalog.com/latest/#Language/Primitive%20Operators/Over.htm Dyalog]
* J [https://www.jsoftware.com/help/dictionary/d632.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/ampco NuVoc]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]

Revision as of 21:50, 9 September 2021

Over () is a primitive dyadic operator which takes two function operands and produces a derived function which pre-processes the argument(s) using the monadic right operand, before applying the left operand on/between the result(s).

Explanation

When the resulting function is used monadically, it has the same behaviour as if the Beside or Atop operator had been used:

  (g ⍥ h) ⍵
g (h ⍵)

When the resulting function is used dyadically, both arguments are pre-processed:

⍺ (g ⍥ h) ⍵
(h ⍺) g (h ⍵)

Examples

      x←3 1 2
      y←4 6 5
      x +⍥(⌈/) y ⍝ add the max of x and max of y
9
      ⍝ same as
      (⌈/x)+⌈/y
9

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