vector-copy - copy a vector

LIBRARY

(import (scheme base))              ;R7RS

SYNOPSIS

(vector-copy vector)
(vector-copy vector start)
(vector-copy vector start end)

DESCRIPTION

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.

RETURN VALUES

Returns a single value; a new vector object.

EXAMPLES

(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)

COMPATIBILITY

There is an equivalent procedure is SRFI-43.

ERRORS

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.

SEE ALSO

vector-copy! (3scm)

STANDARDS

R7RS, SRFI-43

HISTORY

The first RnRS revision with this procedure is R7RS, which took it from SRFI-43.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.