From: Difference between revisions

Jump to navigation Jump to search
→‎History: Remove speculative Dyalog 20.0 reference and consolidate
m (Text replacement - "</source>" to "</syntaxhighlight>")
(→‎History: Remove speculative Dyalog 20.0 reference and consolidate)
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|<code>⊇</code> <code>@</code>
|<code>⊇</code> <code>@</code>
|}
|}
'''From''' (<code>⊇</code> or <code>@</code> and also called '''Select''', or, [[humour]]ously, ''Sane Indexing'') is a [[primitive function]] that selects multiple [[major cell]]s of its right argument using an array of [[index|indices]] given by its left. The primitive often offers additional functionality for a [[nested]] left argument, which varies from one language to another. It appears in [[SAX]] (as <syntaxhighlight lang=apl inline>@</syntaxhighlight>), [[Extended Dyalog APL]], [[dzaima/APL]], and [[KAP]] (as <syntaxhighlight lang=apl inline>⊇</syntaxhighlight>), [[J]] (as <syntaxhighlight lang=j inline>{</syntaxhighlight>), and [[BQN]] (as <code>⊏</code>).
'''From''' (<code>⊇</code> or <code>@</code> and also called '''Select''', or, [[humour]]ously, ''Sane Indexing'') is a [[primitive function]] that selects multiple [[major cell]]s of its right argument using an array of [[index|indices]] given by its left. The primitive often offers additional functionality for a [[nested]] left argument, which varies from one language to another. It appears in [[SAX]] (as <syntaxhighlight lang=apl inline>@</syntaxhighlight>), [[Extended Dyalog APL]], [[dzaima/APL]], and [[Kap]] (as <syntaxhighlight lang=apl inline>⊇</syntaxhighlight>), [[J]] (as <syntaxhighlight lang=j inline>{</syntaxhighlight>), and [[BQN]] (as <code>⊏</code>).


== Common usage ==
== Common usage ==
Line 41: Line 41:


== History ==
== History ==
From (<code>{</code>) was introduced in 1986 by [[A Dictionary of APL]], with the same meaning now used in [[J]]. This description introduced the characteristic feature of selection of multiple cells simultaneously, as well as the pairing with monadic [[Catalogue]], scatter-point indexing, negative indices, and the ability to exclude rather than include indices using a third level of boxing. [[Roger Hui]] expressed his support for the new definition with a presentation at the next [[APL conference]]<ref>[[Roger Hui]]. [https://www.jsoftware.com/papers/from.htm Some Uses of <code>{</code> and <code>}</code>] at [[APL87]].</ref>, and it was included in J from the earliest drafts in 1990—a limited version had even appeared in [[Arthur Whitney]]'s one-page interpreter prototype.
From (<code>{</code>) was introduced in 1983 by [[Rationalized APL]]. This description introduced the characteristic feature of selection of multiple cells simultaneously, along with scatter-point indexing and the ability to exclude rather than include indices using a third level of boxing. It was expanded slightly in [[A Dictionary of APL]] to allow negative indices and was paired with monadic [[Catalogue]], giving the same meaning for <code>{</code> now used in [[J]]. [[Roger Hui]] expressed his support for the new definition with a presentation at [[APL87]],<ref>[[Roger Hui]]. [https://www.jsoftware.com/papers/from.htm Some Uses of <code>{</code> and <code>}</code>] at [[APL87]].</ref> and it was included in J from the earliest drafts in 1990—a limited version had even appeared in [[Arthur Whitney]]'s one-page interpreter prototype.


[[SHARP APL]] followed A Dictionary of APL and used <code>{</code>, but this was later deprecated, programmers being told to use <code>@</code> instead.<ref>Soliton Associates Limited. SHARP APL for UNIX Language Guide. [https://abrudz.github.io/SAX2/SAX61.pdf#G41.16516 Deprecated Primitives: Braces]. 2000.</ref>
[[SHARP APL]] followed A Dictionary of APL and used <code>{</code>, but this was later deprecated, programmers being told to use <code>@</code> instead.<ref>Soliton Associates Limited. SHARP APL for UNIX Language Guide. [https://abrudz.github.io/SAX2/SAX61.pdf#G41.16516 Deprecated Primitives: Braces]. 2000.</ref>


The name Select and glyph <code>⊇</code> were introduced by [[Extended Dyalog APL]], and subsequently adopted by [[dzaima/APL]] and [[KAP]].
The name Select and glyph <code>⊇</code> were introduced by [[Extended Dyalog APL]], and subsequently adopted by [[dzaima/APL]] and [[Kap]]. In addition to including it in Extended and the later [[Dyalog APL Vision]], [[Adám Brudzewsky]] described Select as a possible future [[Dyalog APL]] primitive in a presentation at [[Dyalog '22]].<ref>[[Adám Brudzewsky]]. [https://dyalog.tv/Dyalog22/?v=itGiA56NSl8 Filling the Core Language Gaps]. [[Dyalog '22]]. 2022-10-13.</ref>


[[BQN]] uses the name Select like Extended Dyalog APL but takes the direction of the glyph <code>⊏</code>, as well as negative indexing, from J. For a nested left argument it uses a new extension: instead of viewing nesting as elaboration of each element of the left argument, it instead treats it as providing a list of left arguments to select from multiple axes of the right argument. This extension provides the functionality of APL's [[Index (function)|Index]] not by requiring the left argument as a whole to be enclosed but by requiring that each of its elements be an array.
[[BQN]] uses the name Select like Extended Dyalog APL but takes the direction of the glyph <code>⊏</code>, as well as negative indexing, from J. For a nested left argument it uses a new extension: instead of viewing nesting as elaboration of each element of the left argument, it instead treats it as providing a list of left arguments to select from multiple axes of the right argument. This extension provides the functionality of APL's [[Index (function)|Index]] not by requiring the left argument as a whole to be enclosed but by requiring that each of its elements be an array.
Line 59: Line 59:
* [https://abrudz.github.io/SAX2/SAX61.pdf#M44.9.from SAX]
* [https://abrudz.github.io/SAX2/SAX61.pdf#M44.9.from SAX]
* [https://mlochbaum.github.io/BQN/doc/select.html BQN]
* [https://mlochbaum.github.io/BQN/doc/select.html BQN]
=== Publications ===
* [https://github.com/abrudz/primitives/blob/main/select.aplf APL model]


== References ==
== References ==
<references/>
<references/>
{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu