vector->string(3scm) Scheme Programmer's Manual vector->string(3scm)

vector->string - convert a vector of characters to a string

(import (scheme base))              ;R7RS

(vector->string vector)
(vector->string vector start)
(vector->string vector start end)

Returns a newly allocated string of the objects contained in the elements of vector between start (inclusive) and end (exclusive). The order of the characters is preserved.

The argument start defaults to 0 and end defaults to the length of vector.

Loko Scheme
There is a single unique empty string object, so the returned string will not always be newly allocated.

Returns a single value; a string.

(vector->string #(#\1 #\2 #\3))  =>  "123"

R7RS says that this procedure and a few others were added in order to round out the sequence operations.

This procedure is unique to R7RS. Compatible procedures can be found in SRFI-133 and SRFI-152.

It is an error to pass the wrong number of arguments, and to pass an argument that is outside its domain. In particular, vector must be a vector of characters, start must be non-negative and not greater than end, and end must not be greater than the length of vector. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

It is also an error for vector to contain a character which the implementation does not support. 7-bit ASCII (except #\null) must be supported. Any other character is optional and potentially an error (as described above). You can use the full-unicode feature identifier in cond-expand(3scm) to check if all of Unicode 6.0 is supported.

string->vector(3scm)

R7RS

This procedure first appeared in R7RS.

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-27