Next: , Previous: , Up: Simple Data Types   [Contents][Index]


6.6.6 Bytevectors

A bytevector is a raw bit 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: bytevector contents can be accessed 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 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).


Next: , Previous: , Up: Simple Data Types   [Contents][Index]