4,494
edits
(Created page with ":''This page is about the concept of extracting items from an array. See Index for the concept of a location in an array. See Bracket indexing, Index (function), [...") |
(Don't put links in headings, per Wikipedia:Manual_of_Style/Linking#General_points_on_linking_style) |
||
Line 21: | Line 21: | ||
</source> | </source> | ||
=== Relationship to | === Relationship to leading axis theory === | ||
For implementations that support [[leading axis theory]], it is common to select [[cell|cells]] or especially [[major cell|major cells]] of an array. In these implementations, [[Index (function)|Squad]] can be used with short left [[argument]] so that the omitted trailing axes can be selected as-is. A few implementations also support [[Select]], the primitive dedicated to selecting major cells. | For implementations that support [[leading axis theory]], it is common to select [[cell|cells]] or especially [[major cell|major cells]] of an array. In these implementations, [[Index (function)|Squad]] can be used with short left [[argument]] so that the omitted trailing axes can be selected as-is. A few implementations also support [[Select]], the primitive dedicated to selecting major cells. | ||
Line 32: | Line 32: | ||
</source> | </source> | ||
=== | === Replicate as a special case === | ||
Various forms of [[Replicate]] can be used to select one or more indices over a single axis. <source lang=apl inline>X/Y</source> applies to the last axis, <source lang=apl inline>X⌿Y</source> to the first, and <source lang=apl inline>X/[K]Y</source> applies to the K-th axis. All the other axes are kept intact. The main difference from other indexing primitives is that X does not specify the indices; instead, it specifies how many copies of the corresponding indices to include in the result. | Various forms of [[Replicate]] can be used to select one or more indices over a single axis. <source lang=apl inline>X/Y</source> applies to the last axis, <source lang=apl inline>X⌿Y</source> to the first, and <source lang=apl inline>X/[K]Y</source> applies to the K-th axis. All the other axes are kept intact. The main difference from other indexing primitives is that X does not specify the indices; instead, it specifies how many copies of the corresponding indices to include in the result. |