Bracket indexing

, or simply Indexing, is a special primitive function which uses the postcircumfix notation  instead of a normal prefix function. The result of  is an array formed with items of X extracted by the index specification Y.

Simple indexing
Most APL implementations support only this mode of indexing. In its simplest form,  on vector X and scalar Y extracts the item of X at index Y. In general, Y can be an array of any shape, with each item being a valid index in X; then   is a Y-shaped array which contains the indexed results.

For higher-rank array X with rank n, the notation  selects the indexes of X over each axis. If some  is omitted, it implies all indices of k-th axis is selected, which is equivalent to specifying. The resulting shape is the concatenation of shapes of Y1, Y2, ..., Yn.

The major limitation of this indexing mode is that it only supports rectangular selection. For example, it is not possible to form  from a matrix X by single indexing.

Choose indexing
In this mode, the index specification Y is a depth-2 nested array. Each item of Y is a vector whose length is the rank of X, and the result is a collection of items of X selected by each item of Y.

Reach indexing
In this mode, Y is a depth-3 nested array. Each item of Y is a vector of nested vectors which specify the index at each level of nesting (which is equivalent to the indexing by Pick). This allows to extract multiple items from a deeply nested array with a single indexing operation.

Implementation support
Dyalog APL and NARS2000 support all three modes of indexing. NARS2000 even supports mixing Choose and Reach indexing modes. J does not have this notation at all.

Documentation

 * Dyalog
 * NARS2000
 * APLX