- (vector-map proc vector[1] vector[2] ...)procedure
It is an error if proc does not accept as many arguments as there are vectors and return a single value.
The vector-map procedure applies proc element-wise to the elements of the vectors and returns a vector of the results, in order. If more than one vector is given and not all vectors have the same length, vector-map terminates when the shortest vector runs out. The dynamic order in which proc is applied to the elements of the vectors is unspecified. If multiple returns occur from vector-map, the values returned by earlier returns are not mutated.
(vector-map cadr '#((a b) (d e) (g h))) ==> #(b e h) (vector-map (lambda (n) (expt n n)) '#(1 2 3 4 5)) ==> #(1 4 27 256 3125) (vector-map + '#(1 2 3) '#(4 5 6 7)) ==> #(5 7 9) (let ((count 0)) (vector-map (lambda (ignored) (set! count (+ count 1)) count) '#(a b))) ==> #(1 2) or #(2 1)