make-vector(3scm) Scheme Programmer's Manual make-vector(3scm)

make-vector - allocate a new vector

(import (rnrs))                     ;R6RS
(import (rnrs base))                ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

(make-vector k)
(make-vector k fill)

Returns a newly allocated vector of k elements. If a second argument is given, then each element is initialized to fill. Otherwise the initial contents of each element is unspecified.

Implementations vary in how well they handle a large k argument. Vectors typically need approximately four or eight bytes per element and a large k means that the system can run out of memory. If this happens then some implementations will crash while others raise &implementation-restriction.

Returns a single value; a freshly allocated vector.

(make-vector 3 #f)  =>  #(#f #f #f)

This procedure works the same everywhere apart from error handling.

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
R7RS
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

make-list(3scm), vector(3scm)

R4RS, IEEE Scheme, R5RS, R6RS, R7RS

This procedure first appeared in R2RS.

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-07-22