# 6.5 Functions for Vectors

Here are some functions that relate to vectors:

### `function`vectorpobjectâ€‹

This function returns `t` if `object` is a vector.

``(vectorp [a])     â‡’ t(vectorp "asdf")     â‡’ nil``

### `function`vector\&rest objectsâ€‹

This function creates and returns a vector whose elements are the arguments, `objects`.

``(vector 'foo 23 [bar baz] "rats")     â‡’ [foo 23 [bar baz] "rats"](vector)     â‡’ []``

### `function`make-vectorlength objectâ€‹

This function returns a new vector consisting of `length` elements, each initialized to `object`.

``(setq sleepy (make-vector 9 'Z))     â‡’ [Z Z Z Z Z Z Z Z Z]``

### `function`vconcat\&rest sequencesâ€‹

This function returns a new vector containing all the elements of `sequences`. The arguments `sequences` may be proper lists, vectors, strings or bool-vectors. If no `sequences` are given, the empty vector is returned.

The value is either the empty vector, or is a newly constructed nonempty vector that is not `eq` to any existing vector.

``(setq a (vconcat '(A B C) '(D E F)))     â‡’ [A B C D E F](eq a (vconcat a))     â‡’ nil``
``(vconcat)     â‡’ [](vconcat [A B C] "aa" '(foo (6 7)))     â‡’ [A B C 97 97 foo (6 7)]``

The `vconcat` function also allows byte-code function objects as arguments. This is a special feature to make it easy to access the entire contents of a byte-code function object. See Byte-Code Objects.

For other concatenation functions, see `mapconcat` in Mapping Functions, `concat` in Creating Strings, and `append` in Building Lists.

The `append` function also provides a way to convert a vector into a list with the same elements:

``(setq avector [1 two (quote (three)) "four" [five]])     â‡’ [1 two '(three) "four" [five]](append avector nil)     â‡’ (1 two '(three) "four" [five])``