vector-copy - copy a vector
(import (scheme base)) ;R7RS
(vector-copy vector)
(vector-copy vector start)
(vector-copy vector start end)
Returns a newly allocated copy of the elements of the given vector
between start and end. The elements of the new vector are the
same, in the sense of eqv?(3scm), as the elements of the old vector.
Returns a single value; a new vector object.
(define a #(1 8 2 8)) ; a may be immutable
(define b (vector-copy a)) ; b is mutable
(vector-set! b 0 3)
b => #(3 8 2 8)
(vector-copy b 1 3) => #(8 2)
There is an equivalent procedure is SRFI-43.
It is an error if the wrong number of arguments was passed or an argument was
outside its domain. R7RS implementations may signal an error, extend the
procedure's domain of definition to include such arguments, or fail
catastrophically.
The first RnRS revision with this procedure is R7RS, which took it from SRFI-43.