Over: Difference between revisions

Jump to navigation Jump to search
510 bytes added ,  21:50, 9 September 2021
no edit summary
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]]

Navigation menu