Commute: Difference between revisions

Jump to navigation Jump to search
415 bytes added ,  03:17, 8 September 2021
m
Added fork emulation
No edit summary
m (Added fork emulation)
Line 15: Line 15:
</source>
</source>
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[NARS2000]]}}
{{Works in|[[Dyalog APL]], [[dzaima/APL]], [[NARS2000]]}}
[[Commute]] can be used to emulate a <source lang=apl inline>f g h</source> [[Fork]] when combined with [[Compose]]:
<source lang=apl>
g⍨∘f⍨∘h⍨ x 
x g⍨∘f⍨∘h x ⍝ the last ⍨ is being used monadically, i.e. Selfie
x g⍨∘f⍨ h x
(h x) g⍨∘f x ⍝ the last ⍨ is being used dyadically, i.e. Swap
(h x) g⍨ (f x)
(f x) g (h x) the last ⍨ is being used dyadically, i.e. Swap
</source>


== External links ==
== External links ==
24

edits

Navigation menu