Dyadic operator: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Operators category)
m (Text replacement - "</source>" to "</syntaxhighlight>")
Tags: Mobile edit Mobile web edit
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
In [[APL syntax]], a '''dyadic operator''' (or '''conjunction''') is an [[operator]] which takes two [[operand]]s, one on each side. In [[APL\360]] the only dyadic operator was [[Inner Product]], but other operators such as [[Beside]] and [[Bind]] (<source lang=apl inline>∘</source>), and [[Power (operator)|Power]] (<source lang=apl inline>⍣</source>) have become common, and languages such as [[J]], [[NARS2000]], and [[dzaima/APL]] have added many experimental dyadic operators.
In [[APL syntax]], a '''dyadic operator''' (or '''conjunction''') is an [[operator]] which takes two [[operand]]s, one on each side. In [[APL\360]] the only dyadic operator was [[Inner Product]], but other operators such as [[Beside]] and [[Bind]] (<syntaxhighlight lang=apl inline>∘</syntaxhighlight>), and [[Power (operator)|Power]] (<syntaxhighlight lang=apl inline>⍣</syntaxhighlight>) have become common, and languages such as [[J]], [[NARS2000]], and [[dzaima/APL]] have added many experimental dyadic operators.


The term "dyadic operator" refers to the [[operator valence|valence]] of the operator itself, that is, the number of operands. When applied, it produces a [[derived function]], which can have a different [[function valence]]. For example, the [[Inner Product]] is usually a dyadic operator that produces a [[dyadic function]] (<source lang=apl inline>+.× A</source> is a [[SYNTAX ERROR]], unless it's defined to be the [[Determinant]] operator), while [[Power (operator)|Power]] generally produces an [[ambivalent]] function. The [[Compose]] function can produce an ambivalent function <source lang=apl inline>f∘g</source>, or a monadic function <source lang=apl inline>A∘f</source> if an array <source lang=apl inline>A</source> is [[Bind|bound]] to a function <source lang=apl inline>f</source>.
The term "dyadic operator" refers to the [[operator valence|valence]] of the operator itself, that is, the number of operands. When applied, it produces a [[derived function]], which can have a different [[function valence]]. For example, the [[Inner Product]] is usually a dyadic operator that produces a [[dyadic function]] (<syntaxhighlight lang=apl inline>+.× A</syntaxhighlight> is a [[SYNTAX ERROR]], unless it's defined to be the [[Determinant]] operator), while [[Power (operator)|Power]] generally produces an [[ambivalent]] function. The [[Compose]] function can produce an ambivalent function <syntaxhighlight lang=apl inline>f∘g</syntaxhighlight>, or a monadic function <syntaxhighlight lang=apl inline>A∘f</syntaxhighlight> if an array <syntaxhighlight lang=apl inline>A</syntaxhighlight> is [[Bind|bound]] to a function <syntaxhighlight lang=apl inline>f</syntaxhighlight>.
{{APL syntax}}[[Category:Operators]]
{{APL syntax}}[[Category:Operators]]

Latest revision as of 22:15, 10 September 2022

In APL syntax, a dyadic operator (or conjunction) is an operator which takes two operands, one on each side. In APL\360 the only dyadic operator was Inner Product, but other operators such as Beside and Bind (), and Power () have become common, and languages such as J, NARS2000, and dzaima/APL have added many experimental dyadic operators.

The term "dyadic operator" refers to the valence of the operator itself, that is, the number of operands. When applied, it produces a derived function, which can have a different function valence. For example, the Inner Product is usually a dyadic operator that produces a dyadic function (+.× A is a SYNTAX ERROR, unless it's defined to be the Determinant operator), while Power generally produces an ambivalent function. The Compose function can produce an ambivalent function f∘g, or a monadic function A∘f if an array A is bound to a function f.

APL syntax [edit]
General Comparison with traditional mathematicsPrecedenceTacit programming (Train, Hook, Split composition)
Array Numeric literalStringStrand notationObject literalArray notation (design considerations)
Function ArgumentFunction valenceDerived functionDerived operatorNiladic functionMonadic functionDyadic functionAmbivalent functionDefined function (traditional)DfnFunction train
Operator OperandOperator valenceTradopDopDerived operator
Assignment MultipleIndexedSelectiveModified
Other Function axisBracket indexingBranchStatement separatorQuad nameSystem commandUser commandKeywordDot notationFunction-operator overloadingControl structureComment