Direct definition (operator): Difference between revisions

Jump to navigation Jump to search
docs
(Created page with ":''The Del glyph <code>∇</code> is more commonly used for dfn recursion or to indicate a defined function.'' {{Built-in|Direct definition|∇}}, in NARS, is a primitive dyadic operator that defines an anonymous function based on source strings. Its left operand is the source for the function's dyadic case and the right is the source for the monadic case. One of these operands may be replaced with a Jot (using this operator a...")
 
(docs)
Line 4: Line 4:


The format of a source string is similar to that used in [[Direct definition (Iverson)|Iverson's direct definition]], with several small differences. Multiple expressions can be used if separated by <syntaxhighlight lang=apl inline>⋄</syntaxhighlight>. <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> indicate the left and right [[argument]]s, and <syntaxhighlight lang=apl inline>_</syntaxhighlight> is added to indicate [[recursion]]. Conditions are still indicated with colons <syntaxhighlight lang=apl inline>:</syntaxhighlight>, but the mechanism is extended: rather than a boolean condition placed between false and true cases, it's placed first, and returns a scalar or vector of natural numbers. Each number indicates one of the following groups of statements (separated by further <syntaxhighlight lang=apl inline>:</syntaxhighlight>s and numbered starting at 0), and these groups will then be evaluated, with the result of the last evaluated expression returned from the function as a whole.
The format of a source string is similar to that used in [[Direct definition (Iverson)|Iverson's direct definition]], with several small differences. Multiple expressions can be used if separated by <syntaxhighlight lang=apl inline>⋄</syntaxhighlight>. <syntaxhighlight lang=apl inline>⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵</syntaxhighlight> indicate the left and right [[argument]]s, and <syntaxhighlight lang=apl inline>_</syntaxhighlight> is added to indicate [[recursion]]. Conditions are still indicated with colons <syntaxhighlight lang=apl inline>:</syntaxhighlight>, but the mechanism is extended: rather than a boolean condition placed between false and true cases, it's placed first, and returns a scalar or vector of natural numbers. Each number indicates one of the following groups of statements (separated by further <syntaxhighlight lang=apl inline>:</syntaxhighlight>s and numbered starting at 0), and these groups will then be evaluated, with the result of the last evaluated expression returned from the function as a whole.
== External links ==
* [https://www.sudleyplace.com/APL/Nested%20Arrays%20System.pdf#page=58 Documentation]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Defining functions]]
{{APL built-ins}}[[Category:Primitive operators]][[Category:Defining functions]]

Navigation menu