Operator valence: Difference between revisions

Jump to navigation Jump to search
27 bytes added ,  20:55, 10 September 2022
m
Text replacement - "<source" to "<syntaxhighlight"
m (Operators category)
m (Text replacement - "<source" to "<syntaxhighlight")
Line 3: Line 3:
In [[APL syntax]], an [[operator]]'s '''valence''' is the number of [[operand]]s it takes. The valence of an operator is an intrinsic property and must be known in order to parse an APL sentence containing it. Operators may take either one operand, in which case they are called [[Monadic operator|monadic]], or two, in which case they are called [[Dyadic operator|dyadic]]. The valence of an operator is distinct from the [[valence]] of the [[derived function]] produced by after it is applied to its operands: the operator's valence counts operands while the derived function's valence counts [[argument]]s. Unlike with functions, there is no possibility for a [[niladic]] or [[ambivalent]] operator.
In [[APL syntax]], an [[operator]]'s '''valence''' is the number of [[operand]]s it takes. The valence of an operator is an intrinsic property and must be known in order to parse an APL sentence containing it. Operators may take either one operand, in which case they are called [[Monadic operator|monadic]], or two, in which case they are called [[Dyadic operator|dyadic]]. The valence of an operator is distinct from the [[valence]] of the [[derived function]] produced by after it is applied to its operands: the operator's valence counts operands while the derived function's valence counts [[argument]]s. Unlike with functions, there is no possibility for a [[niladic]] or [[ambivalent]] operator.


One special case is that of the [[Inner Product]] and [[Outer Product]] operators. The Inner Product is a dyadic operator <source lang=apl inline>f.g</source>, and the Outer Product is written <source lang=apl inline>∘.g</source>. Various APLs interpret the latter syntax in different ways. In [[Iverson notation]] and [[APL\360]] an outer product was described as a kind of inner product with an omitted left operand (making the Inner Product ambivalent), but later APLs such as [[Dyalog APL]] typically refer to Outer Product as a separate, monadic operator with a special syntax. [[SHARP APL]] defines <source lang=apl inline>∘</source> to be an array ([[Nil]]), so that Inner Product is a purely dyadic operator and the Outer Product is a special case with an array left operand.
One special case is that of the [[Inner Product]] and [[Outer Product]] operators. The Inner Product is a dyadic operator <syntaxhighlight lang=apl inline>f.g</source>, and the Outer Product is written <syntaxhighlight lang=apl inline>∘.g</source>. Various APLs interpret the latter syntax in different ways. In [[Iverson notation]] and [[APL\360]] an outer product was described as a kind of inner product with an omitted left operand (making the Inner Product ambivalent), but later APLs such as [[Dyalog APL]] typically refer to Outer Product as a separate, monadic operator with a special syntax. [[SHARP APL]] defines <syntaxhighlight lang=apl inline>∘</source> to be an array ([[Nil]]), so that Inner Product is a purely dyadic operator and the Outer Product is a special case with an array left operand.


{{APL syntax}}[[Category:Operators]]
{{APL syntax}}[[Category:Operators]]

Navigation menu