(lispref.info)Array Type

Next: String Type Prev: List Type Up: Programming Types

Array Type

   An "array" is composed of an arbitrary number of other Lisp objects,
arranged in a contiguous block of memory.  Any element of an array may
be accessed in constant time.  In contrast, accessing an element of a
list requires time proportional to the position of the element in the
list.  (Elements at the end of a list take longer to access than
elements at the beginning of a list.)

   Emacs defines two types of array, strings and vectors.  A string is
an array of characters and a vector is an array of arbitrary objects.
Both are one-dimensional.  (Most other programming languages support
multidimensional arrays, but we don't think they are essential in Emacs
Lisp.)  Each type of array has its own read syntax; see Note: String
Type, and Note: Vector Type.

   An array may have any length up to the largest integer; but once
created, it has a fixed size.  The first element of an array has index
zero, the second element has index 1, and so on.  This is called
"zero-origin" indexing.  For example, an array of four elements has
indices 0, 1, 2, and 3.

   The array type is contained in the sequence type and contains both
strings and vectors.

automatically generated by info2www