array (ANSI and GNU Common Lisp Document)

Next: simple-array, Previous: Arrays Dictionary, Up: Arrays Dictionary

#### 15.2.1 array [System Class]

#### Class Precedence List::

array, t

#### Description::

An array contains objects arranged according to a Cartesian coordinate system. An array provides mappings from a set of

fixnums

\left{i_0,i_1,\dots,i_{r-1}\right} to corresponding elements of the array, where 0 \le i_j < d_j, r is the rank of the array, and d_j is the size of dimension j of the array.

When an array is created, the program requesting its creation may declare that all elements are of a particular type, called the expressed array element type. The implementation is permitted to upgrade this type in order to produce the actual array element type, which is the element type for the array is actually specialized. See the function upgraded-array-element-type.

#### Compound Type Specifier Kind::

Specializing.

#### Compound Type Specifier Syntax::

(`array`{`[`{element-type | *} [dimension-spec]`]`})

dimension-spec ::=rank | * | ({dimension | *}*)

#### Compound Type Specifier Arguments::

dimension—a valid array dimension.

element-type—a type specifier.

rank—a non-negative fixnum.

#### Compound Type Specifier Description::

This denotes the set of arrays whose element type, rank, and dimensions match any given element-type, rank, and dimensions. Specifically:

If element-type is the symbol *, arrays are not excluded on the basis of their element type. Otherwise, only those arrays are included whose actual array element type

is the result of upgrading element-type; see Array Upgrading.

If the dimension-spec is a rank, the set includes only those arrays having that rank. If the dimension-spec is a list of dimensions, the set includes only those arrays having a rank given by the length of the dimensions, and having the indicated dimensions; in this case, * matches any value for the corresponding dimension. If the dimension-spec is the symbol *, the set is not restricted on the basis of rank or dimension.

#### See Also::

*print-array*, aref , make-array , vector, Sharpsign A, Printing Other Arrays

#### Notes::

Note that the type `(array t)` is a proper subtype of the type `(array *)`. The reason is that the type `(array t)` is the set of arrays that can hold any object (the elements are of type t, which includes all objects). On the other hand, the type `(array *)` is the set of all arrays whatsoever, including for example arrays that can hold only characters. The type `(array character)` is not a subtype of the type `(array t)`; the two sets are disjoint because the type `(array character)` is not the set of all arrays that can hold characters, but rather the set of arrays that are specialized to hold precisely characters and no other objects.

Next: simple-array, Previous: Arrays Dictionary, Up: Arrays Dictionary