Argument: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
mNo edit summary
m (Categories)
 
(2 intermediate revisions by 2 users not shown)
Line 7: Line 7:
When a non-niladic function is called, its valence is determined from the context around it: if there is a valid argument to its left, it will be called dyadically with that value as its left argument, and otherwise it will be called monadically. A function always needs a valid argument to its right in order to be called directly. [[Derived function]]s and [[train]]s follow different rules: the valence of a function within one of these function depends on its context (for example, the [[operator]] which it is an [[operand]] of) and the valence of the entire derived function.
When a non-niladic function is called, its valence is determined from the context around it: if there is a valid argument to its left, it will be called dyadically with that value as its left argument, and otherwise it will be called monadically. A function always needs a valid argument to its right in order to be called directly. [[Derived function]]s and [[train]]s follow different rules: the valence of a function within one of these function depends on its context (for example, the [[operator]] which it is an [[operand]] of) and the valence of the entire derived function.


{{APL programming language}}
{{APL syntax}}[[Category:Function characteristics]][[Category:APL syntax]]

Latest revision as of 14:25, 30 April 2020

In APL syntax, an argument is one of the values passed to a function. The valence of a function is determined by the number of arguments it takes: niladic functions take no arguments and are immediately evaluated; non-niladic functions may be called monadically (with one argument) or dyadically (with two arguments). Every non-niladic function is called with a right argument while only a dyadic function call uses a left argument.

Only the values used by a function are called arguments. The values accepted by an operator are called operands; once operands are accepted it is the resulting derived function which takes arguments.

Arguments in APL must be arrays. In other languages in the APL family this might not be the case: arguments may be allowed to be other functions, and there may be other first-class datatypes which are not arrays.

When a non-niladic function is called, its valence is determined from the context around it: if there is a valid argument to its left, it will be called dyadically with that value as its left argument, and otherwise it will be called monadically. A function always needs a valid argument to its right in order to be called directly. Derived functions and trains follow different rules: the valence of a function within one of these function depends on its context (for example, the operator which it is an operand of) and the valence of the entire derived function.


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