Yorick has a bewildering variety of different ways to refer to individual array elements or subsets of array elements. In order to master the language, you must learn to use them all. Nearly all of the examples later in this manual use one or more of these indexing techniques, so trust me to show you how to use them later:
A scalar integer index refers to a specific array element. In a
multi-dimensional array, this "element" is itself an array -- the
specified row, column, or hyperplane.
An index which is nil or omitted refers to the entire range of the
corresponding array dimension.
An index range of the form start:stop or start:stop:step
refers to an evenly spaced subset of the corresponding array
An array of integers refers to an arbitrary subset, possibly including
repeated values, of the corresponding array dimension.
The special symbol -, or -:start:stop, is the pseudo-index.
It inserts an index in the result which was not present in the array
being indexed. Although this sounds recondite, the pseudo-index is
often necessary in order to make two arrays conformable for a binary
The special symbol .. or * is a rubber-index. A
rubber-index stands for zero or more dimensions of the array being
indexed. This syntax allows you to specify a value for the final index
of an array, even when you don't know how many dimensions the array has.
The .. version leaves the original dimension count intact; the
* version collapses all dimensions into a single long dimension in
The special symbol + marks an index for matrix multiplication.
Many statistical functions, such as sum, avg, and max
can be applied along a specific dimension of an array. These reduce the
rank of the resulting array, just like a scalar integer index value.
- Several finite difference functions, such as zcen (zone center) and cum (cumulative sums) can be applied along a specific array dimension. You can use these to construct numerical analogues to the operations of differential and integral calculus.