Function styles: Difference between revisions

Jump to navigation Jump to search
→‎Direct definition: The windy road from direct definition to anonymous functions
(→‎Tacit functions: Some description of function assignment moved to Assignment)
(→‎Direct definition: The windy road from direct definition to anonymous functions)
 
Line 13: Line 13:
{{Main|Direct definition (notation)}}
{{Main|Direct definition (notation)}}


Although the term "direct definition" has been used in various ways by different authors, one of the more notable uses is that described by [[Ken Iverson]] in ''Elementary Functions'', published 1974.<ref>[[Ken Iverson]]. ''Elementary Functions'' [https://www.jsoftware.com/papers/DirectDef.htm chapter 10]. [[IBM]]. 1974.</ref> Initially called "formal function definition", this style was called "direct definition" by Iverson and others at [[IPSA]] when they used it to describe new language features in [[SHARP APL]].<ref name="satn-direct"/> It was never implemented as part of SHARP APL, although utilities to translate it to SHARP's function definition, or the "canonical form", were provided. Iverson's direct definition required the name of the function like existing defined functions, but not those of the arguments: instead the left argument was named <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and the right argument <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>. This argument naming would later by adopted by [[John Scholes]]' [[dfn]]s, but direct definition differed in many other respects.
Although the term "direct definition" has been used in various ways by different authors, one of the more notable uses is that described by [[Ken Iverson]] in ''Elementary Functions'', published 1974.<ref>[[Ken Iverson]]. ''Elementary Functions'' [https://www.jsoftware.com/papers/DirectDef.htm chapter 10]. [[IBM]]. 1974.</ref> Initially called "formal function definition", this style was called "direct definition" by Iverson and others at [[IPSA]] when they used it to describe new language features in [[SHARP APL]].<ref name="satn-direct"/> It was never implemented as part of SHARP APL, although utilities to translate it to SHARP's function definition, or the "canonical form", were provided. Iverson's direct definition required the name of the function like existing defined functions, but not those of the arguments: instead the left argument was named <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and the right argument <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>.
 
Various implementations and proposals changed direct definition into an anonymous function syntax, typically modifying other details in the process. The [[direct definition operator]] <syntaxhighlight lang=apl inline>∇</syntaxhighlight> discussed by Iverson and implemented in [[NARS]] created a function from source code [[string]]s, and eventually led to [[J]]'s explicit definition operator <syntaxhighlight lang=apl inline>:</syntaxhighlight>. John Bunda proposed a syntax using curly braces<ref>John Bunda. [https://dl.acm.org/doi/abs/10.1145/384282.28346 APL function definition notation]. [[APL Quote Quad]] Volume 17, Issue 4. 1987-01-01.</ref> while J. Philip Benkard proposed another using parentheses.<ref>J. Philip Benkard. [https://dl.acm.org/doi/10.1145/97808.97820 Nonce functions] at [[APL90]].</ref> This line of investigation eventually found success in [[John Scholes]]' [[dfn]]s, which shared the use of <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> with direct definition, as well as the general concept of <syntaxhighlight lang=apl inline>:</syntaxhighlight> indicating a condition, but differed in many details.


== Anonymous functions ==
== Anonymous functions ==

Navigation menu