string->vector(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

✨ string->vector β€” it's giving string-to-vector energy ✨

okay so real talk, this page lives in the Scheme Programmer's Manual (that's the 3scm bit, iykyk) and it's about one iconic little procedure. let's get into it πŸ’…


πŸ’– NAME

string->vector β€” convert a string to a vector. that's it. that's the whole gig. slay.


πŸ“š LIBRARY

(import (scheme base))              ;R7RS

yes bestie you gotta import it, it's not just gonna show up on its own 🫢


🌸 SYNOPSIS

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

three whole forms, pick your fighter ✨


πŸ¦‹ DESCRIPTION

Returns a newly created vector initialized to the elements of string between start (inclusive) and end (exclusive). the order of the characters is preserved β€” no shuffling, no chaos, everything stays in its lane πŸ’…

if you omit them, start defaults to 0 and end defaults to the length of string. so like, the lazy version totally works, no cap.


πŸŽ€ RETURN VALUES

Returns a single value β€” a vector object. one value, one vibe, one icon πŸ‘‘


⭐ EXAMPLES

(string->vector "ABC")  =>  #(#\A #\B #\C)

literally the whole thing. ate and left no crumbs πŸ“


πŸ’€ ERRORS

It is an error to pass the wrong number of arguments, and to pass an argument that's outside its domain. and because Scheme loves to keep you on your toes, implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically 😭 so yeah, maybe don't. not me warning you dramatically but also genuinely, that last one is real πŸ”₯


πŸ‘€ SEE ALSO

  • string->list(3scm) β€” the cousin, the sibling, the other one

🌈 STANDARDS

R7RS, SRFI-133, SRFI-140, SRFI-152 β€” certified, validated, multiple-standards-approved πŸ’œ


🧚 HISTORY

This procedure first appeared in R7RS. a legend from day one, no notes.


πŸŽ€ AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. more info (and the whole treasure trove) lives at https://github.com/schemedoc/manpages/ 🫢


bestie reminder: start is inclusive, end is exclusive, and yes everybody gets that backwards the first time πŸ™ˆ

okay that's the whole page!! sourced from the scheme-manpages project, dated 2022-05-14 β€” mwah, go convert some strings πŸ’–βœ¨

πŸ“¦ where this page comes from