2,963
edits
(Created page with "In APL's history many ways to create functions and operators (as opposed to using existing primitive and system functions) have been introduced, with each APL...") |
mNo edit summary |
||
Line 1: | Line 1: | ||
In APL's history many ways to create [[function]]s and [[operator]]s (as opposed to using existing [[primitive]] and [[system function]]s) have been introduced, with each APL dialect supporting one or more of these styles. The three major branches are [[defined function]]s, which use a header declaring the function and argument names, [[anonymous function]]s such as [[dfn]]s, which also consist of a list of statements but have no header and use fixed argument names, and [[tacit function]]s, which are created by manipulating existing functions with no reference to [[argument]]s. | In APL's history many ways to create [[function]]s and [[operator]]s (as opposed to using existing [[primitive function|primitive]] and [[system function]]s) have been introduced, with each APL dialect supporting one or more of these styles. The three major branches are [[defined function]]s, which use a header declaring the function and argument names, [[anonymous function]]s such as [[dfn]]s, which also consist of a list of statements but have no header and use fixed argument names, and [[tacit function]]s, which are created by manipulating existing functions with no reference to [[argument]]s. | ||
== Defined functions == | == Defined functions == | ||
Line 23: | Line 23: | ||
* 1994: [[K]]'s functions are written with curly braces | * 1994: [[K]]'s functions are written with curly braces | ||
* 1996: [[Dyalog APL]] adds [[dfn]]s, another kind of functions written with curly braces | * 1996: [[Dyalog APL]] adds [[dfn]]s, another kind of functions written with curly braces | ||
Although tacit functions also are unnamed when created, "anonymous function" refers to | Although tacit functions also are unnamed when created, "anonymous function" refers to an ''explicit'' anonymous function, that is, one that has a function body referring to arguments but no header defining its name. | ||
By far the most influential of these definitions within APL has been Dyalog's [[dfn]]s, which have also been included in most APLs created since: [[NARS2000]] includes them in addition to traditional function definition, and [[GNU APL]] includes a limited variant. Dialects such as [[ngn/apl]], [[APL\iv]], [[dzaima/APL]], and [[RAD]] | By far the most influential of these definitions within APL has been Dyalog's [[dfn]]s, which have also been included in most APLs created since: [[NARS2000]] includes them in addition to traditional function definition, and [[GNU APL]] includes a limited variant. Dialects such as [[ngn/apl]], [[APL\iv]], [[dzaima/APL]], and [[RAD]] use only dfns, with no other explicit function style. | ||
The varieties of anonymous function definition given above can be grouped into two categories. [[NARS]] and [[J]] have an operator-based definition, where an [[operator]] is applied to arrays with the function defined being the result (J's version also uses the special right operand 0 to indicate that a multi-line definition follows). [[K]] and [[Dyalog]] have syntax-based anonymous functions, which use dedicated syntax rules like older defined functions do in Dyalog. | The varieties of anonymous function definition given above can be grouped into two categories. [[NARS]] and [[J]] have an operator-based definition, where an [[operator]] is applied to arrays with the function defined being the result (J's version also uses the special right operand 0 to indicate that a multi-line definition follows). [[K]] and [[Dyalog]] have syntax-based anonymous functions, which use dedicated syntax rules like older defined functions do in Dyalog. |