elisp: Vectors

 
 6.4 Vectors
 ===========
 
 A “vector” is a general-purpose array whose elements can be any Lisp
 objects.  (By contrast, the elements of a string can only be characters.
 SeeStrings and Characters.)  Vectors are used in Emacs for many
 purposes: as key sequences (SeeKey Sequences), as symbol-lookup
 tables (SeeCreating Symbols), as part of the representation of a
 byte-compiled function (SeeByte Compilation), and more.
 
    Like other arrays, vectors use zero-origin indexing: the first
 element has index 0.
 
    Vectors are printed with square brackets surrounding the elements.
 Thus, a vector whose elements are the symbols ‘a’, ‘b’ and ‘a’ is
 printed as ‘[a b a]’.  You can write vectors in the same way in Lisp
 input.
 
    A vector, like a string or a number, is considered a constant for
 evaluation: the result of evaluating it is the same vector.  This does
 not evaluate or even examine the elements of the vector.  See
 Self-Evaluating Forms.
 
    Here are examples illustrating these principles:
 
      (setq avector [1 two '(three) "four" [five]])
           ⇒ [1 two (quote (three)) "four" [five]]
      (eval avector)
           ⇒ [1 two (quote (three)) "four" [five]]
      (eq avector (eval avector))
           ⇒ t