Function: Difference between revisions

Jump to navigation Jump to search
27 bytes added ,  22:19, 10 September 2022
m
Text replacement - "<source" to "<syntaxhighlight"
m (Text replacement - "</source>" to "</syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
 
Line 15: Line 15:
* [[Dyadic]] if only a two-argument call can be valid
* [[Dyadic]] if only a two-argument call can be valid
* [[Ambivalent]] if both cases are possible
* [[Ambivalent]] if both cases are possible
* no name, if neither case is possible (for instance <source lang=apl inline>3∘+∘4</syntaxhighlight>)
* no name, if neither case is possible (for instance <syntaxhighlight lang=apl inline>3∘+∘4</syntaxhighlight>)
while the last case can be produced, it is unlikely to be useful, and almost never discussed.
while the last case can be produced, it is unlikely to be useful, and almost never discussed.


Line 23: Line 23:
Every APL comes with [[primitive function]]s, and almost always [[system function]]s, which are defined by the language. In order to create other functions, there are three general methods. Every APL supports at least one of these but there is no universally supported method.
Every APL comes with [[primitive function]]s, and almost always [[system function]]s, which are defined by the language. In order to create other functions, there are three general methods. Every APL supports at least one of these but there is no universally supported method.
* [[Tacit programming]] treats functions as values to be manipulated directly: [[derived function]]s can be created by applying [[operator]]s to [[operand]]s, and [[train]]s are functions formed from multiple functions.
* [[Tacit programming]] treats functions as values to be manipulated directly: [[derived function]]s can be created by applying [[operator]]s to [[operand]]s, and [[train]]s are functions formed from multiple functions.
* [[Anonymous function]]s are defined by a series of expressions that make reference to function arguments ([[dfn]]s use the fixed names <source lang=apl inline>⍺</syntaxhighlight> and <source lang=apl inline>⍵</syntaxhighlight>). When created they have no name, but they can be [[Assignment|assigned]] one.
* [[Anonymous function]]s are defined by a series of expressions that make reference to function arguments ([[dfn]]s use the fixed names <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>). When created they have no name, but they can be [[Assignment|assigned]] one.
* [[Defined function]]s have a function header with syntax that includes the function's name and reflects how it will be used. This is the only way to create [[niladic function]]s.
* [[Defined function]]s have a function header with syntax that includes the function's name and reflects how it will be used. This is the only way to create [[niladic function]]s.


Navigation menu