GNU Info

Info Node: (elisp)Sequences Arrays Vectors

(elisp)Sequences Arrays Vectors


Next: Hash Tables Prev: Lists Up: Top
Enter node , (file) or (file)node

Sequences, Arrays, and Vectors
******************************

   Recall that the "sequence" type is the union of two other Lisp
types: lists and arrays.  In other words, any list is a sequence, and
any array 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 that has a slot for each of
its elements.  All the elements are accessible in constant time, but
the length of an existing array cannot be changed.  Strings, vectors,
char-tables and bool-vectors are the four types of 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.  Finding the
Nth element requires looking through N cons cells, so 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 following diagram shows the relationship between these types:

               _____________________________________________
              |                                             |
              |          Sequence                           |
              |  ______   ________________________________  |
              | |      | |                                | |
              | | List | |             Array              | |
              | |      | |    ________       ________     | |
              | |______| |   |        |     |        |    | |
              |          |   | Vector |     | String |    | |
              |          |   |________|     |________|    | |
              |          |  ____________   _____________  | |
              |          | |            | |             | | |
              |          | | Char-table | | Bool-vector | | |
              |          | |____________| |_____________| | |
              |          |________________________________| |
              |_____________________________________________|

   The elements of vectors and lists may be any Lisp objects.  The
elements of strings are all characters.

Sequence Functions
Functions that accept any kind of sequence.
Arrays
Characteristics of arrays in Emacs Lisp.
Array Functions
Functions specifically for arrays.
Vectors
Special characteristics of Emacs Lisp vectors.
Vector Functions
Functions specifically for vectors.
Char-Tables
How to work with char-tables.
Bool-Vectors
How to work with bool-vectors.

automatically generated by info2www version 1.2.2.9