Byte
----
`(require 'byte)'
Some algorithms are expressed in terms of arrays of small integers.
Using Scheme strings to implement these arrays is not portable vis-a-vis
the correspondence between integers and characters and non-ascii
character sets. These functions abstract the notion of a "byte".
- Function: byte-ref bytes k
K must be a valid index of BYTES. `byte-ref' returns byte K of
BYTES using zero-origin indexing.
- Procedure: byte-set! bytes k byte
K must be a valid index of BYTES%, and BYTE must be a small
integer. `Byte-set!' stores BYTE in element K of BYTES and
returns an unspecified value.
- Function: make-bytes k
- Function: make-bytes k byte
`Make-bytes' returns a newly allocated byte-array of length K. If
BYTE is given, then all elements of the byte-array are initialized
to BYTE, otherwise the contents of the byte-array are unspecified.
- Function: bytes-length bytes
`bytes-length' returns length of byte-array BYTES.
- Function: write-byte byte
- Function: write-byte byte port
Writes the byte BYTE (not an external representation of the byte)
to the given PORT and returns an unspecified value. The PORT
argument may be omitted, in which case it defaults to the value
returned by `current-output-port'.
- Function: read-byte
- Function: read-byte port
Returns the next byte available from the input PORT, updating the
PORT to point to the following byte. If no more bytes are
available, an end of file object is returned. PORT may be
omitted, in which case it defaults to the value returned by
`current-input-port'.
- Function: bytes byte ...
Returns a newly allocated byte-array composed of the arguments.
- Function: bytes->list bytes
- Function: list->bytes bytes
`Bytes->list' returns a newly allocated list of the bytes that
make up the given byte-array. `List->bytes' returns a newly
allocated byte-array formed from the small integers in the list
BYTES. `Bytes->list' and `list->bytes' are inverses so far as
`equal?' is concerned.