vector-copy!(3scm) Scheme Programmer's Manual vector-copy!(3scm)

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.

vector-copy(3scm)

R7RS

R7RS got this procedure from SRFI-43.

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

2023-01-26