Over: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Built-in|Over| | {{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 | 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, | 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←3 1 2 | |||
y←4 5 | y←4 6 5 | ||
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