bytevector?(3scm)

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

✨ NAME ✨

okay so this is bytevector? β€” it's a Scheme thing from the Scheme Programmer's Manual, and what it does is test if an object is a bytevector πŸ’…

πŸ“š LIBRARY πŸ“š

here's where you import it from, depending on your vibe:

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

πŸŽ€ SYNOPSIS πŸŽ€

(bytevector? obj)

πŸ’– DESCRIPTION πŸ’–

So you hand it obj and it's like: is this a bytevector bestie or not πŸ‘€

  • if obj is a bytevector β†’ it gives you back #t (slay)
  • if obj is not a bytevector β†’ it gives you back #f (not slay, but valid)

that's literally the whole thing. no cap.

🫢 RETURN VALUES 🫢

Returns a single boolean object, exactly as the description says. one boolean, that's it, that's the whole return πŸ’«

πŸ”₯ EXAMPLES πŸ”₯

look at these, they eat:

(bytevector? #vu8(1 2 3))  => #t   ; R6RS
(bytevector? #u8(1 2 3))   => #t   ; R7RS
(bytevector? "123")        => #f
(bytevector? '#(1 2 3))    => #f

see how "123" is a string and not a bytevector? and '#(1 2 3) is a regular vector, also not a bytevector? yeah. don't get it twisted 🧚

🌈 COMPATIBILITY 🌈

Bytevectors are a disjoint type in both R6RS and R7RS β€” meaning they're their own separate little category, they don't overlap with other types. this is specified in R6RS standard libraries Β§ 2 and in R7RS Β§ 3.2. iconic of the standards committee tbh πŸ‘‘

πŸ’€ ERRORS πŸ’€

bestie, this procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” the wrong number of arguments was passed. like, you gave it too many or too few args and it's Not Happy.
  • 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. yes, catastrophically, they really said that 😭
fr fr read that R7RS bit again β€” "fail catastrophically" is not a drill πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

  • make-bytevector(3scm) β€” the one that actually makes the bytevectors, since this page just checks for them

⭐ STANDARDS ⭐

R6RS, R7RS 🌸

πŸ¦‹ HISTORY πŸ¦‹

R6RS is the first Scheme report to have bytevectors. before that? no bytevectors. wild, honestly πŸ™ˆ

πŸ’œ 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 bye bestie, go check your bytevectors πŸ’– this was bytevector?(3scm) from the Scheme Programmer's Manual, dated 2021-01-17 β€” mwah, love that for us πŸŽ€βœ¨

πŸ“¦ where this page comes from