A bytevector is a raw byte string. The (rnrs bytevectors)
module provides the programming interface specified by the
Revised^6 Report on the Algorithmic Language
Scheme (R6RS). It contains procedures to manipulate bytevectors and
interpret their contents in a number of ways: as signed or unsigned
integer of various sizes and endianness, as IEEE-754 floating point
numbers, or as strings. It is a useful tool to encode and decode binary
data. The R7RS offers its own set of bytevector
procedures (see Bytevector Procedures in R7RS).
The R6RS (Section 4.3.4) specifies an external representation for
bytevectors, whereby the octets (integers in the range 0–255) contained
in the bytevector are represented as a list prefixed by #vu8
:
#vu8(1 53 204)
denotes a 3-byte bytevector containing the octets 1, 53, and 204. Like string literals, booleans, etc., bytevectors are “self-quoting”, i.e., they do not need to be quoted:
#vu8(1 53 204) ⇒ #vu8(1 53 204)
Bytevectors can be used with the binary input/output primitives (see Binary I/O).