Function: Difference between revisions

Jump to navigation Jump to search
20 bytes added ,  10:28, 13 March 2020
m
Line 25: Line 25:
The traditional way of defining functions in APL, and the most common way to define functions currently, is to create a [[defined function]], which consists of a sequence of APL statements. This is the only way to create a [[niladic function]], although not all ways to define a function support creating niladic functions. There are three major families of function definition:
The traditional way of defining functions in APL, and the most common way to define functions currently, is to create a [[defined function]], which consists of a sequence of APL statements. This is the only way to create a [[niladic function]], although not all ways to define a function support creating niladic functions. There are three major families of function definition:
* [[Direct definition]], introduced by [[Ken Iverson]] in [[A Programming Language]] but rarely implemented. Direct definition might be considered a kind of APL [[wikipedia:pseudocode|pseudocode]].
* [[Direct definition]], introduced by [[Ken Iverson]] in [[A Programming Language]] but rarely implemented. Direct definition might be considered a kind of APL [[wikipedia:pseudocode|pseudocode]].
* [[Tradfn]]s (often simply called "defined functions"), introduced by [[APL\360]]. In these functions, a header line describes the way the function is called and the result is placed in a variable whose name is given in the header.
* [[Tradfn]]s (often simply called "defined functions"), introduced by [[APL\360]]. In these functions, a [[function header|header]] line describes the way the function is called and the result is placed in a variable whose name is given in the header.
* [[dfn]]s, developed by [[John Scholes]] and introduced in [[Dyalog APL]]. In a dfn, the arguments are given the fixed names <source lang=apl inline>⍺</source> and <source lang=apl inline>⍵</source>, and the result of the first non-assignment statement is returned.
* [[dfn]]s, developed by [[John Scholes]] and introduced in [[Dyalog APL]]. In a dfn, the arguments are given the fixed names <source lang=apl inline>⍺</source> and <source lang=apl inline>⍵</source>, and the result of the first non-assignment statement is returned.


{{APL syntax}}
{{APL syntax}}

Navigation menu