Direct definition (notation): Difference between revisions

Jump to navigation Jump to search
m
no edit summary
(Created page with "Ken Iverson's '''direct definition''' is a function style written with a name followed by <code>:</code> and a result, using <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> for arguments. The result may be one expression, which is evaluated to apply the function, or three expressions separated by <code>:</code>, in which case the middle expression is evaluated to determine which of the other tw...")
 
mNo edit summary
Line 7: Line 7:
The [[valence]] of the function is determined by which argument names appear: it's [[niladic]] if neither <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> nor <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> is used in any expression, [[monadic]] if only <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> is used, and [[dyadic]] if <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> is used. As direct definition was intended to represent pure functions (without side effects), [[assignment]] within an expression always localizes its target.
The [[valence]] of the function is determined by which argument names appear: it's [[niladic]] if neither <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> nor <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> is used in any expression, [[monadic]] if only <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> is used, and [[dyadic]] if <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> is used. As direct definition was intended to represent pure functions (without side effects), [[assignment]] within an expression always localizes its target.


Direct definition was defined in Iverson's 1974 text ''Elementary Functions'',<ref>[[Ken Iverson]]. ''Elementary Functions'' [https://www.jsoftware.com/papers/DirectDef.htm chapter 10]. [[IBM]]. 1974.</ref> where it was called "formal function definition", and used in writings by Iverson<ref>[[K. E. Iverson]]. [https://www.jsoftware.com/papers/APLStyle.htm Programming Style in APL] at [[IPSA '78]].</ref> and others including [[Gene McDonnell]]<ref>[[Eugene McDonnell]] and Jeffrey Shallit. [https://www.jsoftware.com/papers/eem/infinity.htm Extending APL to infinity] at [[APL80]].</ref><ref>[[Eugene McDonnell]]. SATN-40: [https://www.jsoftware.com/papers/satn40.htm Complex Numbers]. 1981-06-20.</ref> and [[Donald McIntyre]].<ref>[[D. B. McIntyre]]. "Experience with Direct Definition One-liners in Writing APL Applications" at [[IPSA '78]].</ref> Having been used in the [[SHARP APL]] Technical Notes (SATNs) 34 and 35, it was described by Iverson in SATN-36 and subsequently used in SATNs 40 and 41. The syntax was never implemented in [[SHARP APL]] itself, but a set of library functions for working with it were defined, including <syntaxhighlight lang=apl inline>CFD</syntaxhighlight> ("canonical from direct") to translate it to SHARP's function definition, or the "canonical form".<ref>[[Ken Iverson]]. SATN-36: Direct Definition. 1980-04-20.</ref>
Direct definition was defined in Iverson's 1974 text ''Elementary Functions'',<ref>[[Ken Iverson]]. ''Elementary Functions'' [https://www.jsoftware.com/papers/DirectDef.htm chapter 10]. [[IBM]]. 1974.</ref> where it was called "formal function definition", and used in writings by Iverson<ref>[[Ken Iverson|K. E. Iverson]]. [https://www.jsoftware.com/papers/APLStyle.htm Programming Style in APL] at [[IPSA '78]].</ref> and others including [[Gene McDonnell]]<ref>[[Eugene McDonnell]] and Jeffrey Shallit. [https://www.jsoftware.com/papers/eem/infinity.htm Extending APL to infinity] at [[APL80]].</ref><ref>[[Eugene McDonnell]]. SATN-40: [https://www.jsoftware.com/papers/satn40.htm Complex Numbers]. 1981-06-20.</ref> and [[Donald McIntyre]].<ref>[[Donald McIntyre|D. B. McIntyre]]. "Experience with Direct Definition One-liners in Writing APL Applications" at [[IPSA '78]].</ref> Having been used in the [[SHARP APL]] Technical Notes (SATNs) 34 and 35, it was described by Iverson in SATN-36 and subsequently used in SATNs 40 and 41. The syntax was never implemented in [[SHARP APL]] itself, but a set of library functions for working with it were defined, including <syntaxhighlight lang=apl inline>CFD</syntaxhighlight> ("canonical from direct") to translate it to SHARP's function definition, or the "canonical form".<ref>[[Ken Iverson]]. SATN-36: Direct Definition. 1980-04-20.</ref>


== References ==
== References ==
<references/>
<references/>
{{APL syntax}}[[Category:Kinds of functions]][[Category:Defining functions]]
{{APL syntax}}[[Category:Kinds of functions]][[Category:Defining functions]]

Navigation menu