Tacit programming: Difference between revisions

Jump to navigation Jump to search
735 bytes added ,  18:33, 29 June 2022
no edit summary
No edit summary
Line 66: Line 66:
|<source lang=apl>⍺ (g h) ⍵</source>|| {{←→}} ||<source lang=apl>⍺ g (h ⍵)</source>
|<source lang=apl>⍺ (g h) ⍵</source>|| {{←→}} ||<source lang=apl>⍺ g (h ⍵)</source>
|}
|}
=== Summary of rules ===
These are the rules applied in Dyalog APL:
{|
|<source lang=apl>  (f g h) ⍵ </source>|| {{←→}} ||<source lang=apl> (  f ⍵) g (  h ⍵)</source>
|-
|<source lang=apl>⍺ (f g h) ⍵ </source>|| {{←→}} ||<source lang=apl> (⍺ f ⍵) g (⍺ h ⍵)</source>
|-
|<source lang=apl>  (A g h) ⍵ </source>|| {{←→}} ||<source lang=apl>      A g (  h ⍵)</source>
|-
|<source lang=apl>⍺ (A g h) ⍵ </source>|| {{←→}} ||<source lang=apl>      A g (⍺ h ⍵)</source>
|-
|<source lang=apl>    (g h) ⍵ </source>|| {{←→}} ||<source lang=apl>        g (  h ⍵)</source>
|-
|<source lang=apl>  ⍺ (g h) ⍵ </source>|| {{←→}} ||<source lang=apl>        g (⍺ h ⍵)</source>
|}
=== Problems caused by function-operator overloading ===
=== Problems caused by function-operator overloading ===
Trains that use a [[Function-operator_overloading|hybrid function-operator]] in its [[function]] role can run into the problems with the hybrid being parsed as a monadic [[operator]] instead of as a function. This happens when a function appears to the immediate left of the hybrid, causing this function to be bound as the hybrid's operand — the hybrid taking on an operator role — rather than supplying a left [[argument]] or post-processing the result.
Trains that use a [[Function-operator_overloading|hybrid function-operator]] in its [[function]] role can run into the problems with the hybrid being parsed as a monadic [[operator]] instead of as a function. This happens when a function appears to the immediate left of the hybrid, causing this function to be bound as the hybrid's operand — the hybrid taking on an operator role — rather than supplying a left [[argument]] or post-processing the result.

Navigation menu