Common Lisp the Language, 2nd Edition

Next: Array Creation Up: Common Lisp the Language Previous: Primitive Hash Function

# 17. Arrays

An array is an object with components arranged according to a rectilinear coordinate system. In principle, an array in Common Lisp may have any number of dimensions, including zero. (A zero-dimensional array has exactly one element.) In practice, an implementation may limit the number of dimensions supported, but every Common Lisp implementation must support arrays of up to seven dimensions. Each dimension is a non-negative integer; if any dimension of an array is zero, the array has no elements.

An array may be a general array, meaning each element may be any Lisp object, or it may be a specialized array, meaning that each element must be of a given restricted type.

One-dimensional arrays are called vectors. General vectors may contain any Lisp object. Vectors whose elements are restricted to type `string-char` are called strings. Vectors whose elements are restricted to type `bit` are called bit-vectors.

X3J13 voted in March 1989 (CHARACTER-PROPOSAL) to eliminate the type `string-char` and to redefine the type `string` to be the union of one or more specialized vector types, the types of whose elements are subtypes of the type `character`.

- Array Creation
- Array Access
- Array Information
- Functions on Arrays of Bits
- Fill Pointers
- Changing the Dimensions of an Array