Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.
Next: Arrays, Previous: Bit Vectors, Up: Data Types [Contents][Index]
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).
• Bytevector Endianness: | Dealing with byte order. | |
• Bytevector Manipulation: | Creating, copying, manipulating bytevectors. | |
• Bytevectors as Integers: | Interpreting bytes as integers. | |
• Bytevectors and Integer Lists: | Converting to/from an integer list. | |
• Bytevectors as Floats: | Interpreting bytes as real numbers. | |
• Bytevectors as Strings: | Interpreting bytes as Unicode strings. | |
• Bytevectors as Arrays: | Guile extension to the bytevector API. | |
• Bytevectors as Uniform Vectors: | Bytevectors and SRFI-4. |
Next: Arrays, Previous: Bit Vectors, Up: Data Types [Contents][Index]