GNU Info

Info Node: (librep.info)Vectors

(librep.info)Vectors


Next: Strings Prev: Lists Up: Sequences
Enter node , (file) or (file)node

Vectors
-------

   A vector is a fixed-size sequence of Lisp objects, each element may
be accessed in constant time--unlike lists where the time taken to
access an element is proportional to the position of the element.

   The read syntax of a vector is an opening square bracket, followed
by zero or more space-separated objects, followed by a closing square
bracket. For example,

     [zero one two three]

   In general it is best to use vectors when the number of elements to
be stored is known and lists when the sequence may grow or shrink.

 - Function: vectorp object
     This function returns true if its argument, OBJECT, is a vector.

 - Function: vector #!rest elements
     This function creates a new vector containing the arguments given
     to the function.

          (vector 1 2 3)
              => [1 2 3]
          
          (vector)
              => []

 - Function: make-vector size #!optional initial-value
     Returns a new vector, SIZE elements big. If INITIAL-VALUE is
     defined each element of the new vector is set to INITIAL-VALUE,
     otherwise they are all `()'.

          (make-vector 4)
              => [() () () ()]
          
          (make-vector 2 t)
              => [t t]


automatically generated by info2www version 1.2.2.9