bytevector(3scm)
π bytevector β bestie's guide to making bytes
okay so first things first: this page lives in the Scheme Programmer's Manual (yes the whole manual, we're fancy like that β¨) and this one little entry is all about bytevector.
π LIBRARY
(import (scheme base)) ;R7RS
that's the import, periodt. if you want this procedure you gotta pull in (scheme base) and that comment right there says it's R7RS flavored π
β¨ SYNOPSIS β¨
(bytevector byte ...)
that's it. that's the whole vibe. you hand it some bytes, it hands you back a bytevector π«Ά
πΈ DESCRIPTION πΈ
Returns a newly allocated bytevector containing its arguments. like, fresh out the box, brand new, nobody else's bytevector, it's giving main character energy π
π« RETURN VALUES π«
Returns a single bytevector object. one (1) bytevector. that's the whole return situation, no cap π
π₯ EXAMPLES π₯
(bytevector 1 3 5 1 3 5) => #u8(1 3 5 1 3 5)
(bytevector) => #u8()
look at that first one β 1 3 5 1 3 5, iconic pattern, ate π
and the second one? no args, no bytes, still a perfectly valid empty bytevector #u8(). we love a zero-argument queen π
π¦ COMPATIBILITY π¦
heads up bestie β this procedure is absent from R6RS π like it literally does not exist there. if you're on R6RS, use u8-list->bytevector(3scm) instead, iykyk.
π ERRORS π
It is an error if one of the arguments is not an exact integer object in the range from 0 to 255 inclusive. so like, 0 through 255, nothing else, don't try it π«
and here's the chaotic part β implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically πππ that last one is real, the manpage literally says that. so yeah, lowkey don't pass it a bad value unless you're feeling brave.
fr fr, "fail catastrophically" is not a drill. keep your bytes between 0 and 255 inclusive π΄
π SEE ALSO π
u8-list->bytevector(3scm)β your R6RS bestie, go say hi π«Ά
β STANDARDS β
R7RS β that's the standard, that's the source of truth, that's the ~vibe~ π
π§ HISTORY π§
This procedure first appeared in R7RS. so like... it wasn't in R6RS (which we already established, but the history section is confirming it, consistency queen π)
π 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/ β go check it out, the whole squad is there π
and that's the page bestie!! π source + version: this is a 3scm page from the scheme-manpages project, dated 2021-02-28. stay bytey, stay valid, stay in that 0β255 range πβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms