vector-copy! - copy elements between vectors
(import (scheme base)) ;R7RS
(vector-copy! to at from)
(vector-copy! to at from start)
(vector-copy! to at from start end)
Copies the elements of the vector from between start and
end to vector to, starting at at.
The order in which elements are copied is unspecified, except that if the source
and destination overlap, copying takes place as if the source is first copied
into a temporary vector and then into the destination. This can be achieved
without allocating storage by making sure to copy in the correct direction in
such circumstances.
Returns an unspecified value.
(define a (vector 1 2 3 4 5))
(define b (vector 10 20 30 40 50))
(vector-copy! b 1 a 0 2)
b => #(10 1 2 40 50)
This procedure is unique to R7RS. Compatible procedures can be found in SRFI-43
and SRFI-133.
It is an error if the wrong number of arguments was passed or an argument was
outside its domain. It is an error if at is less than zero or greater
than the length of to. It is also an error if (- (vector-length to) at)
is less than (- end start). Implementations may signal an error, extend the
procedure's domain of definition to include such arguments, or fail
catastrophically.
R7RS got this procedure from SRFI-43.