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 must be more dynamic.
t if its argument, object, is a vector.
(vector 1 2 3)
=> [1 2 3]
(vector)
=> []
nil.
(make-vector 4)
=> [nil nil nil nil]
(make-vector 2 t)
=> [t t]
Go to the first, previous, next, last section, table of contents.