vector->list, list->vector - conversion between vectors and lists
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(vector->list vector start) ;R7RS
(vector->list vector start end) ;R7RS
procedure returns a newly allocated list
of the objects contained in the elements of
procedure returns a newly created vector
initialized to the elements of the list
In both procedures, order is preserved.
procedure is limited to the elements between
These arguments default to 0 and the length of the vector, respectively.
- Chez Scheme, Loko Scheme
The empty vector is a unique object, so
(list->vector '()) does not return a newly allocated vector.
These procedures both return a single value; a vector object or a list.
(vector->list '#(dah dah didah))
=> (dah dah didah)
(list->vector '(dididit dah))
=> #(dididit dah)
These procedures work the same everywhere except for the
arguments, which are only present in the R7RS variant of
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.
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.
In particular, if
is passed a cyclical list then the procedure may not terminate.
These procedures first appeared in R2RS. They were left out of IEEE
Scheme. But in spite of this,
appears as an example in the standard.
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.