string(3scm)

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

πŸ’– string(3scm) β€” the Scheme Programmer's Manual, bestie edition πŸ’–

okay so you know how every manpage ever is like, aggressively dry? not this one. we're in the Scheme Programmer's Manual today and honestly? it's giving helpful. let's go.


✨ NAME ✨

string β€” construct a string out of the characters you hand it πŸŽ€

πŸ“š LIBRARY πŸ“š

here's where you can find this little icon, depending on your flavor of Scheme:

(import (rnrs))                     ;R6RS
(import (rnrs base))                ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

🌸 SYNOPSIS 🌸

(string char ...)

πŸ’« DESCRIPTION πŸ’«

Returns a newly allocated string made up of the arguments. that's it. that's the whole vibe. you give it characters, it gives you back a string, fresh out of the allocation oven 🫢

🧚 IMPLEMENTATION NOTES 🧚

heads up: some implementations have a single empty string object. like, one shared one. no cap. see make-string(3scm) for the details πŸ‘€

πŸŽ€ RETURN VALUES πŸŽ€

Returns a single value β€” a string. just the one. she's a solo act πŸ’…

πŸ”₯ EXAMPLES πŸ”₯

(string #\Q #\u #\u #\x)  =>  "Quux"

look at her go. iconic.

🌈 APPLICATION USAGE 🌈

this procedure is mostly used when building quite small strings. she's not here for the giant string situations, she's here for the cute little ones. also! it's one way to convert a character to a string ✨

πŸ’œ COMPATIBILITY πŸ’œ

this procedure has worked the same way since R4RS, notwithstanding the limits on strings that an implementation may have. so like, old-school but still relevant. main character energy honestly πŸ‘‘

πŸ’€ ERRORS πŸ’€

can it raise exceptions? yes bestie, with these condition types:

  • &assertion (R6RS) β€” an argument was not a character. rude of you, but ok πŸ™ˆ
  • Unsupported characters (R7RS) β€” it is an error to pass this procedure 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. you can use the full-unicode feature identifier in cond-expand(7scm) to check if all of Unicode 6.0 is supported πŸ¦‹
  • R7RS β€” 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 πŸ˜­πŸ’€ (not a drill, that's the actual wording, "fail catastrophically")
lowkey terrifying last option but go off R7RS

πŸ‘€ SEE ALSO πŸ‘€

  • make-string(3scm)
  • open-string-output-port(3scm)

⭐ STANDARDS ⭐

R4RS, IEEE Scheme, R5RS, R6RS, R7RS

πŸ¦‹ HISTORY πŸ¦‹

First appeared in R4RS. she's been here a while and she's still slaying 🌸

πŸ’– 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/ 🫢


okay that's the whole thing! mwah πŸ’‹ this was the 2022-04-13 edition of string(3scm) from the Scheme Programmer's Manual β€” go forth and construct some tiny strings, you absolute icon πŸŽ€βœ¨

πŸ“¦ where this page comes from