Pick: Difference between revisions

Jump to navigation Jump to search
126 bytes added ,  15:20, 8 November 2022
m
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
== Examples ==
== Examples ==


The left [[argument]] X must be a [[vector]] where each element of X specifies the multi-dimensional [[index]] at each layer of the right argument Y. The result of <source lang=apl inline>X⊃Y</source> is the item of Y at the location specified by X.
The left [[argument]] X must be a [[scalar]] or [[vector]] where each element of X specifies the multi-dimensional [[index]] at each layer of the right argument Y. The result of <syntaxhighlight lang=apl inline>X⊃Y</syntaxhighlight> is the item of Y at the location specified by X.


<source lang=apl>
<syntaxhighlight lang=apl>
       ⎕←G←2 3⍴('ABC' 1)('DEF' 2)('GHI' 3)('JKL' 4)('MNO' 5)('PQR' 6)
       ⎕←G←2 3⍴('ABC' 1)('DEF' 2)('GHI' 3)('JKL' 4)('MNO' 5)('PQR' 6)
┌───────┬───────┬───────┐
┌───────┬───────┬───────┐
Line 24: Line 24:
       ((2 1)1 2)⊃G
       ((2 1)1 2)⊃G
K
K
</source>
</syntaxhighlight>
 
== See also ==
* [[Index (function)]]
* [[Bracket indexing]]
* [[Select]]


== External links ==
== External links ==
Line 30: Line 35:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Pick.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Pick.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_610.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_610.htm APLX]


{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Navigation menu