Next: , Previous: , Up: vectors   [Index]


24.4 Constructors

Function: vector-concatenate vector-list

Append the elements of vector-list together into a single vector. Guaranteed to return a freshly allocated vector.

Function: %vector-concatenate-reverse vector-list final-vector nvalues
Macro: vector-concatenate-reverse vector-list
Macro: vector-concatenate-reverse vector-list final-vector
Macro: vector-concatenate-reverse vector-list final-vector nvalues

Reverse vector-list then concatenate the elements, which must be vectors. The first nvalues items in final-vector are consed onto the beginning of vector-list before performing the the reversal and concatenation operations.

final-vector defaults to the empty vector and nvalues defaults to the length of final-vector.

This procedure is useful in the construction of procedures that accumulate data into lists of vector buffers, and wish to convert the accumulated data into a single vector when done.

Function: vector-append vec ...

Return a newly allocated vector that contains all elements in order from the subsequent locations in the vector arguments.

(vector-append '#(x) '#(y))
⇒ #(x y)

(vector-append '#(a) '#(b c d))
⇒ #(a b c d)

(vector-append '#(a #(b)) '#(#(c)))
⇒ #(a #(b) #(c))
Function: vector-tabulate integer->item len

Construct a vector of size len by applying integer->item to each index from zero (included) to len (excluded), in increasing order, to produce the corresponding vector element.