- This page is about the number of operands of an operator. For the number of arguments of a function, see function valence.
In APL syntax, an operator's valence is the number of operands 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, or two, in which case they are called 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 arguments. 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
f.g, and the Outer Product is written
∘.g. 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
∘ 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 |
|General||Comparison with traditional mathematics ∙ Precedence ∙ Tacit programming|
|Array||Numeric literal ∙ String ∙ Strand notation ∙ Object literal ∙ Array notation|
|Function||Argument ∙ Function valence ∙ Derived function ∙ Niladic function ∙ Monadic function ∙ Dyadic function ∙ Ambivalent function ∙ Tradfn ∙ Dfn ∙ Derived function ∙ Function train|
|Operator||Operand ∙ Operator valence ∙ Tradop ∙ Dop ∙ Derived operator|
|Assignment||Multiple ∙ Indexed ∙ Selective ∙ Modified|
|Other||Function axis ∙ Branching ∙ System command ∙ User command ∙ Keyword ∙ Dot notation|