Function composition: Difference between revisions

Jump to navigation Jump to search
Line 12: Line 12:
[[File:AllCompositions.png|427px]]
[[File:AllCompositions.png|427px]]


Of note here is <source lang=apl inline>f⍨∘g⍨</source> which is [[Reverse-compose]] <source lang=apl inline>⍛</source> (also called ''Before''), and the mirrored version of Beside <source lang=apl inline>∘</source> (also known as ''Compose'' and ''After''), because it is the only such variation that has been implemented, namely in [[dzaima/APL]] and [[Extended Dyalog APL]].  
Of note here is <source lang=apl inline>f⍨∘g⍨</source> which is equivalent to — although with swapped operands — [[Reverse-compose]] <source lang=apl inline>⍛</source> (also called ''Before''), and the mirrored version of Beside <source lang=apl inline>∘</source> (also known as ''Compose'' and ''After''), because it is the only such variation that has been implemented, namely in [[dzaima/APL]] and [[Extended Dyalog APL]].  


A compositional operator that isn't just a shuffled around version of the basic three, is one that applies one operand between the other operand's dyadic result and the result of that other operand's result when [[swap]]ped: <source lang=apl inline>{(⍵ ⍵⍵ ⍺) ⍺⍺ (⍺ ⍵⍵ ⍵)}</source>. This operator can for example be used to implement [[wikipedia:three-way comparison|three-way comparison]]:
A compositional operator that isn't just a shuffled around version of the basic three, is one that applies one operand between the other operand's dyadic result and the result of that other operand's result when [[swap]]ped: <source lang=apl inline>{(⍵ ⍵⍵ ⍺) ⍺⍺ (⍺ ⍵⍵ ⍵)}</source>. This operator can for example be used to implement [[wikipedia:three-way comparison|three-way comparison]]:

Navigation menu