Index (function)


 * This article describes a dyadic primitive function that performs indexing into an array. For the concept of array indices, see Index. For the concept of extracting items from an array, see Indexing.

, also called Squad Indexing after the name of the glyph, is a dyadic primitive function. The result of  is an array formed with items of Y extracted by the index specification X. Index is a proper function alternative to a mode of bracket indexing (which uses a dedicated syntax  ), making it usable within tacit programming. It shares its glyph with the monadic Materialise function.

Examples
The left argument X must be a vector whose length equals the rank of the right argument Y and depth does not exceed 2. Each element of X selects one or more indices over the corresponding axis of the right argument Y. The result is identical to that of bracket indexing in that. The resulting shape equals the concatenation of the shapes of each element of X.

When used with function axis in the form of, K specifies a subset of axes of Y to apply indexing on. The axes not mentioned in K are selected without modification; this corresponds to omitted axes in bracket indexing.

In some dialects that support leading axis theory, short X in  selects from leading axes of Y. In that case, the trailing axes are selected without modification.

Implementation support
This form of indexing is supported in J as boxed left argument of From.

Documentation

 * Dyalog, with axis
 * APLX
 * J Dictionary, Nuvoc