Including the span function introduced in the previous section, there are five common ways to originate arrays — that is, to make an array out of scalar values:
The most primitive way to build an array is to enumerate the successive elements of the array in square brackets. The length of the array is the number of values in the list. An exceptional case is [], which is called “nil”. A Yorick variable has the value nil before it has been defined, and [] is a way to write this special value.
Use array to “broadcast” (see Broadcasting) a value into an array, increasing its number of dimensions. A dimlist is a standard list of arguments used by several Yorick functions (see Dimension Lists). Often, the pseudo-index range function (see Pseudo-Index) is a clearer alternative to the array function.
Use span to generate a list of equally spaced values.
Use indgen (“index generator”) instead of span to generate equally spaced integer values. By default, the list starts with 1.
Use spanl (“span logarithmically”) to generate a list of numbers which increase or decrease by a constant ratio.