vector - make a new vector with the given arguments
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(vector obj ...)
Returns a newly allocated vector whose elements contain
the given arguments.
Some implementations allocate a new object every time this procedure
returns an empty vector. One such implementation is Chicken 5.2.0.
Other implementations, like Chez Scheme 9.5, return the same empty
vector object every time.
Returns a newly allocated vector.
If this procedure is called without arguments it returns the empty
vector, which may or may not be newly allocated.
(vector 'a 'b 'c) => #(a b c)
; Newly allocated vectors are mutable:
(define x (vector 'a 'b 'c))
(vector-set! x 0 'A)
x => #(A b c)
; Vector literals are immutable (but implementations may or
; may not catch this error):
(define x '#(a b c))
(vector-set! x 0 'A) => error
; Implementations are free to choose if they use one or
; multiple objects to represent the empty vector.
(eq? (vector) (vector)) => #t or #f
Applications should avoid calling this procedure with an unknown
number of arguments. The arguments are passed on the stack, which
may not be able to handle a very large number of arguments.
A better way to convert a list to a vector is with the
procedure enjoys wide support across Lisp dialects.
This procedure does not raise exceptions, but it may cause an
out-of-memory condition which generally cannot be handled.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.