Reverse Compose: Difference between revisions

Jump to navigation Jump to search
19 bytes removed ,  18:09, 26 April 2020
no edit summary
m (Adám Brudzewsky moved page Reverse Compose (operator) to Reverse Compose)
No edit summary
Line 1: Line 1:
{{Built-in|Reverse Compose|⍛}}, also known as '''Before''', is a [[primitive operator]] closely related to [[Compose operator|Compose]] (<source lang=apl inline>∘</source>), also known as ''After''. Called [[dyad|dyadically]] with function operands <source lang=apl inline>f</source> and <source lang=apl inline>g</source>, it uses <source lang=apl inline>f</source> [[monad|monadically]] to pre-processes the left argument before applying <source lang=apl inline>g</source> between the pre-processed left argument and the given right argument. <source lang=apl inline>X f⍛g Y</source> is thus equivalent to <source lang=apl inline>(f X) g Y</source>. The operator can be defined as the [[dop]] <source lang=apl inline>{(⍺⍺ ⍺) ⍵⍵ ⍵}</source>. Reverse compose was introduced in [[Extended Dyalog APL]], and then adopted into [[dzaima/APL]].
{{Built-in|Reverse Compose|⍛}}, also known as '''Before''', is a [[primitive operator]] closely related to [[Beside]] (<source lang=apl inline>∘</source>), also known as ''After''. Called [[dyad|dyadically]] with function operands <source lang=apl inline>f</source> and <source lang=apl inline>g</source>, it uses <source lang=apl inline>f</source> [[monad|monadically]] to pre-processes the left argument before applying <source lang=apl inline>g</source> between the pre-processed left argument and the given right argument. <source lang=apl inline>X f⍛g Y</source> is thus equivalent to <source lang=apl inline>(f X) g Y</source>. The operator can be defined as the [[dop]] <source lang=apl inline>{(⍺⍺ ⍺) ⍵⍵ ⍵}</source>. Reverse compose was introduced in [[Extended Dyalog APL]], and then adopted into [[dzaima/APL]].


== Common usage ==
== Common usage ==
Line 9: Line 9:
</source>{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}
</source>{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}


It can also be combined with Compose to create the [[split-compose]] construct. Here, we take the [[sign]] of the left argument and apply it to the absolute value of the right argument:
It can also be combined with Beside to create the [[split-compose]] construct. Here, we take the [[sign]] of the left argument and apply it to the absolute value of the right argument:
[https://tio.run/##SyzI0U2pSszMTfz//1Hf1EdtE4wVDq03VDA5PP1R72wg0TGj5tB6I6CYuYLh//8A Try it online!]<source lang=apl>
[https://tio.run/##SyzI0U2pSszMTfz//1Hf1EdtE4wVDq03VDA5PP1R72wg0TGj5tB6I6CYuYLh//8A Try it online!]<source lang=apl>
       3 ¯1 4×⍛×∘|¯2 ¯7 1
       3 ¯1 4×⍛×∘|¯2 ¯7 1
trusted
41

edits

Navigation menu