Commute: Difference between revisions

Jump to navigation Jump to search
Definition in SHARP and inclusion in Extended APL standard
m (Text replacement - "<source" to "<syntaxhighlight")
(Definition in SHARP and inclusion in Extended APL standard)
 
Line 1: Line 1:
{{Built-in|Commute|⍨}} is a [[monadic operator]] that takes a [[dyadic function]] as operand and modifies how the argument(s) of its derived functions are used. If the derived function is used monadically, the argument is also used as left argument. This usage is also known as '''Self''' or, more informally, '''Selfie'''. If the derived function is used dyadically, the arguments are swapped. This usage is also known as '''Swap'''. The [[glyph]] is also used for [[Constant]].
{{Built-in|Commute|⍨}}, or <syntaxhighlight lang=apl inline>⊂</syntaxhighlight> in [[SHARP APL]], is a [[monadic operator]] that takes a [[dyadic function]] as operand and modifies how the argument(s) of its derived functions are used. If the derived function is used monadically, the argument is also used as left argument. This usage is also known as '''Self''' or, more informally, '''Selfie'''. If the derived function is used dyadically, the arguments are swapped. This usage is also known as '''Swap'''. The [[glyph]] is also used for [[Constant]].


== Examples ==
== Examples ==
Line 28: Line 28:
== History ==
== History ==


The Commute operator was defined in [[Operators and Functions]] in 1978, and taken up by [[NARS]] as a result. [[Dyalog]], influenced by NARS, included the operator early on. While it didn't appear in [[SHARP APL]], it was included in [[J]] as "Reflex/Passive" (<syntaxhighlight lang=j inline>~</syntaxhighlight>).
The Commute operator was defined with glyph <syntaxhighlight lang=apl inline>⍨</syntaxhighlight> in [[Operators and Functions]] in 1978, and taken up by [[NARS]] as a result. [[Dyalog]], influenced by NARS, included the operator early on. [[SHARP APL]] later added the operator with glyph <syntaxhighlight lang=apl inline>⊂</syntaxhighlight>, and it was included in [[J]] as "Reflex/Passive" (<syntaxhighlight lang=j inline>~</syntaxhighlight>). The [[ISO/IEC 13751:2001]] standard included the operator as defined in NARS, although it was unsupported by mainstream dialects such as [[APLX]] and [[APL+Win]] at the time,<ref>F.H.D. van Batenburg. [http://archive.vector.org.uk/art10000930 Conformity of APL Implementations to the ISO APL Standard]. [[Vector journal]] Volume 21, No.3. 2005-05.</ref> and remains unsupported by [[APL2]].


== External links ==
== External links ==
Line 41: Line 41:
* [https://mlochbaum.github.io/BQN/doc/swap.html BQN]
* [https://mlochbaum.github.io/BQN/doc/swap.html BQN]


== References ==
<references/>
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]]

Navigation menu