vector->string(3scm)
β¨ vector->string(3scm) β¨
okay bestie, so this page is from the Scheme Programmer's Manual and we're about to make a vector of characters turn into a whole string. it's giving glow-up transformation, fr fr π
πΈ NAME πΈ
vector->string β convert a vector of characters to a string
π LIBRARY π
(import (scheme base)) ;R7RS
π¦ SYNOPSIS π¦
(vector->string vector)
(vector->string vector start)
(vector->string vector start end)
three ways to call it, pick your fighter π
π DESCRIPTION π
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 β no shuffling, no chaos, the vibes stay exactly where you put them β¨
The argument start defaults to 0 and end defaults to the length of vector. so if you're lazy (same) you can just pass the vector and let it do its thing π«Ά
π§ IMPLEMENTATION NOTES π§
- Loko Scheme β there is a single unique empty string object, so the returned string will not always be newly allocated. lowkey a plot twist but we respect it π
β RETURN VALUES β
Returns a single value; a string. one value, one string, no drama π
π₯ EXAMPLES π₯
(vector->string #(#\1 #\2 #\3)) => "123"
ate and left no crumbs ππ
π RATIONALE π
R7RS says that this procedure and a few others were added in order to round out the sequence operations. basically they wanted the sequence squad to be complete, and honestly? iconic behavior.
πΈ COMPATIBILITY πΈ
This procedure is unique to R7RS. compatible procedures can be found in SRFI-133 and SRFI-152 β so if you're on a different vibe, there's options iykyk π
π ERRORS π
okay so this is the serious part, bestie, pay attention π
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 supported by the implementation
- start must be non-negative and not greater than end
- end must not be greater than the length of vector
The only characters that must be supported by R7RS implementations are the ASCII characters minus NUL. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically. not "fail catastrophically" π that's so real of them
π¦ SEE ALSO π¦
string->vector(3scm)β the reverse queen π
π STANDARDS π
R7RS
π HISTORY π
This procedure first appeared in R7RS.
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
and that's the whole page, bestie β go forth and convert those vectors πβ¨
this slay was brought to you by the 2023-01-27 edition of the Scheme Programmer's Manual, vector->string(3scm) β periodt π
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms