| make-vector(3scm) | Scheme Programmer's Manual | make-vector(3scm) |
NAME
make-vector - allocate a new vector
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs base)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS
SYNOPSIS
(make-vector k) (make-vector k fill)
DESCRIPTION
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.
IMPLEMENTATION NOTES
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.
RETURN VALUES
Returns a single value; a freshly allocated vector.
EXAMPLES
(make-vector 3 #f) => #(#f #f #f)
COMPATIBILITY
This procedure works the same everywhere apart from error handling.
ERRORS
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.
SEE ALSO
make-list(3scm), vector(3scm)
STANDARDS
R4RS, IEEE Scheme, R5RS, R6RS, R7RS
HISTORY
This procedure first appeared in R2RS.
AUTHORS
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 |