Ambivalent function

From APL Wiki
Revision as of 20:17, 16 November 2019 by Miraheze>Adám Brudzewsky
Jump to navigation Jump to search

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