Ambivalent function: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Marshall
No edit summary
Miraheze>Adám Brudzewsky
No edit summary
Line 1: Line 1:
In [[APL syntax]], a [[function]] is '''ambivalent''', or '''variadic''', if it can be called with either [[monadic]] or [[dyadic]] [[valence]]. While every non-[[niladic]] function can be written with one or two arguments, some functions give a [[SYNTAX ERROR]] when called with two arguments (these functions are called monadic) or with only one (these are called dyadic). Ambivalent functions do not give a [[SYNTAX ERROR]] immediately in either case.
In [[Syntactic_overview|APL syntax]], a [[function]] is '''ambivalent''', or '''variadic''', if it can be called with either [[monadic]] or [[dyadic]] [[valence]]. While every non-[[niladic]] function can be written with one or two arguments, some functions give a [[SYNTAX ERROR]] when called with two arguments (these functions are called monadic) or with only one (these are called dyadic). Ambivalent functions do not give a [[SYNTAX ERROR]] immediately in either case.


Being ambivalent, or not, is an inherent property of a function. This contrasts with the terms "monadic" and "dyadic" which may refer either to the function's inherent properties as described above or to the context in which it is used. When an ambivalent function is invoked it has either one argument or two: we would say for example it is an ambivalent function ''called monadically''.
Being ambivalent, or not, is an inherent property of a function. This contrasts with the terms "monadic" and "dyadic" which may refer either to the function's inherent properties as described above or to the context in which it is used. When an ambivalent function is invoked it has either one argument or two: we would say for example it is an ambivalent function ''called monadically''.


{{APL programming language}}
{{APL programming language}}

Revision as of 20:17, 16 November 2019

In APL syntax, a function is ambivalent, or variadic, if it can be called with either monadic or dyadic valence. While every non-niladic function can be written with one or two arguments, some functions give a SYNTAX ERROR when called with two arguments (these functions are called monadic) or with only one (these are called dyadic). Ambivalent functions do not give a SYNTAX ERROR immediately in either case.

Being ambivalent, or not, is an inherent property of a function. This contrasts with the terms "monadic" and "dyadic" which may refer either to the function's inherent properties as described above or to the context in which it is used. When an ambivalent function is invoked it has either one argument or two: we would say for example it is an ambivalent function called monadically.

Template:APL programming language