(lispref.info)Sequences Arrays Vectors
Next: Symbols Prev: Lists Up: Top
Sequences, Arrays, and Vectors
Recall that the "sequence" type is the union of three other Lisp
types: lists, vectors, and strings. In other words, any list is a
sequence, any vector is a sequence, and any string is a sequence. The
common property that all sequences have is that each is an ordered
collection of elements.
An "array" is a single primitive object directly containing all its
elements. Therefore, all the elements are accessible in constant time.
The length of an existing array cannot be changed. Both strings and
vectors are arrays. A list is a sequence of elements, but it is not a
single primitive object; it is made of cons cells, one cell per
element. Therefore, elements farther from the beginning of the list
take longer to access, but it is possible to add elements to the list or
remove elements. The elements of vectors and lists may be any Lisp
objects. The elements of strings are all characters.
The following diagram shows the relationship between these types:
| Sequence |
| ______ ______________________ |
| | | | | |
| | List | | Array | |
| | | | ________ _______ | |
| |______| | | | | | | |
| | | String | | Vector| | |
| | |________| |_______| | |
| |______________________| |
The Relationship between Sequences, Arrays, and Vectors
- Sequence Functions
- Functions that accept any kind of sequence.
- Characteristics of arrays in Emacs Lisp.
- Array Functions
- Functions specifically for arrays.
- Functions specifically for vectors.
automatically generated by info2www