Commute: Difference between revisions

Jump to navigation Jump to search
502 bytes added ,  18:06, 8 September 2021
m
→‎Examples: Clarify that it's a monadic fork only
No edit summary
m (→‎Examples: Clarify that it's a monadic fork only)
(2 intermediate revisions by one other user not shown)
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 monadic <source lang=apl inline>f g h</source> [[Fork]] when combined with [[Compose]] (note the following code is not workable APL, but a series of evaluations):
<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 ==

Navigation menu