Next: Selecting Vector Components, Previous: Vectors, Up: Vectors
Returns a newly allocated vector of k elements. If object is specified,
make-vector
initializes each element of the vector to object. Otherwise the initial elements of the result are unspecified.
Returns a newly allocated vector whose elements are the given arguments.
vector
is analogous tolist
.(vector 'a 'b 'c) => #(a b c)
Returns a newly allocated vector initialized to the elements of list. The inverse of
list->vector
isvector->list
.(list->vector '(dididit dah)) => #(dididit dah)
Similar to
make-vector
, except that the elements of the result are determined by calling the procedure initialization on the indices. For example:(make-initialized-vector 5 (lambda (x) (* x x))) => #(0 1 4 9 16)
K must be greater than or equal to the length of vector. Returns a newly allocated vector of length k. The first
(vector-length
vector)
elements of the result are initialized from the corresponding elements of vector. The remaining elements of the result are unspecified.
Procedure must be a procedure of one argument.
vector-map
applies procedure element-wise to the elements of vector and returns a newly allocated vector of the results, in order from left to right. The dynamic order in which procedure is applied to the elements of vector is unspecified.(vector-map cadr '#((a b) (d e) (g h))) => #(b e h) (vector-map (lambda (n) (expt n n)) '#(1 2 3 4)) => #(1 4 27 256) (vector-map + '#(5 7 9)) => #(5 7 9)