Atop (operator): Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Built-in|Atop|⍤}} is a primitive dyadic operator which takes two function operands and produces a derived function which uses the le...") |
(Close composition (SHARP/J) section) |
||
Line 21: | Line 21: | ||
¯4 ¯6 ¯5 | ¯4 ¯6 ¯5 | ||
</source> | </source> | ||
== Close composition == | |||
In [[SHARP APL]] and [[J]], Atop is implemented as a [[close composition]], meaning that (using SHARP syntax) <source lang=apl inline>f⍥g</source> has the overall [[function rank]] of <source lang=apl inline>g</source>. J uses <code>@</code> for the close form and <code>@:</code> for the rankless form that appears in modern APLs. | |||
== External links == | == External links == | ||
=== Lessons === | === Lessons === |
Revision as of 17:24, 25 April 2022
⍤
|
Atop (⍤
) is a primitive dyadic operator which takes two function operands and produces a derived function which uses the left operand monadically to post-processes the result of the ambivalent right operand.
Explanation
When the resulting function is used monadically, it has the same behaviour as if the Atop 2-train or any of the Beside or Over operators had been used:
(g ⍤ h) ⍵ |
g (h ⍵) |
When the resulting function is used dyadically, the result is post-processed:
⍺ (g ⍤ h) ⍵ |
g ⍺ h ⍵) |
Examples
x←3 1 2 y←4 6 5 x -⍤⌈ y ⍝ the negation of the max of x y ¯4 ¯6 ¯5 ⍝ same as -x⌈y ¯4 ¯6 ¯5
Close composition
In SHARP APL and J, Atop is implemented as a close composition, meaning that (using SHARP syntax) f⍥g
has the overall function rank of g
. J uses @
for the close form and @:
for the rankless form that appears in modern APLs.