From: Difference between revisions

Jump to navigation Jump to search
251 bytes added ,  06:32, 11 May 2021
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{Built-in|Select|⊇}} (jokingly referred to as ''Sane Indexing'') is a [[primitive function]] that allows selecting multiple [[major cell]]s using indices of the cells. It is equivalent to <source lang=apl inline>⌷⍨∘⊂⍨</source> and <source lang=apl inline>⌷⍤0 ∞</source>, only providing a neater notation for such a fundamental concept. It was introduced in [[Extended Dyalog APL]], and then adopted into [[dzaima/APL]] and [[KAP]].
{{Built-in|Select|⊇}} ([[humour|jokingly]] referred to as ''Sane Indexing'') is a [[primitive function]] that allows selecting multiple [[major cell]]s using indices of the cells. It is equivalent to <source lang=apl inline>⌷⍨∘⊂⍨</source> and <source lang=apl inline>⌷⍤0 ∞</source>, only providing a neater notation for such a fundamental concept. It was introduced in [[Extended Dyalog APL]], and then adopted into [[dzaima/APL]] and [[KAP]].


== Common usage ==
== Common usage ==
Line 19: Line 19:
</source>{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}
</source>{{Works in|[[dzaima/APL]], [[Extended Dyalog APL]]}}
== Potential extension ==
== Potential extension ==
Select can be defined as <source lang=apl inline>⌷⍨∘⊃⍨⍤0 ∞</source> thus allowing both the above usage and "scatter point indexing":
Select can be defined as <source lang=apl inline>⌷⍨∘⊃⍨⍤0 ∞</source> thus allowing both the above usage and "scatter point indexing":<ref>[[Richard Park]]. [https://dyalog.tv/Webinar/?v=AgYDvSF2FfU Selecting from Arrays]. [[Dyalog Webinar]]. 16 Apr 2020. (Presented in the form <source lang=apl inline>((⊃⊣)⌷⊢)⍤0 99</source>.)</ref>
<source lang=apl>
<source lang=apl>
       1 4 3 ⊇ 4 4⍴⎕A
       1 4 3 ⊇ 4 4⍴⎕A
Line 32: Line 32:
* [[Bracket indexing]]
* [[Bracket indexing]]
* [[Pick]]
* [[Pick]]
== References ==
<references/>
{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu