From

From ( or   and also called Select, or, humourously, Sane Indexing) is a primitive function that selects multiple major cells of its right argument using an array of 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 ), Extended Dyalog APL, dzaima/APL, and Kap (as  ), J (as  ), and BQN (as  ).

Common usage
Select is commonly used to reorder the major cells of an array. For example, the following shuffles any array into random order: Try it online! Without Select, one would have to write. In this meaning, Select might be written as  or   in Dyalog APL (where 99 exceeds the system's maximum array rank).

In a case where the left argument is a permutation vector for the right argument, the functionality can rightfully be called Permute.

Select especially cleans up expressions for reordering. An ascending sort can be represented as  and "sort by" can be written as  :

Try it online!

Scatter-point
In A Dictionary of APL, J, and SAX, a boxed left argument indicates that each element will be used independently to select a cell of the argument. The behavior on a single element is very similar to APL's Index function. has a left rank of 0, so that results are mixed together and those with different shapes may be padded with fills. In APL this extension can be defined as  thus allowing both the above usage and "scatter point indexing":

History
From 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  now used in J. Roger Hui expressed his support for the new definition with a presentation at APL87, 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, but this was later deprecated, programmers being told to use   instead.

The name Select and glyph  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.

BQN uses the name Select like Extended Dyalog APL but takes the direction of the glyph, 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 not by requiring the left argument as a whole to be enclosed but by requiring that each of its elements be an array.

Documentation

 * J: Dictionary, Nuvoc
 * SAX
 * BQN

Publications

 * APL model