Fold

Given a procedure of two arguments, a starting value, and a byte-blob, reduces the byte-blob using the supplied procedure, from left to right, or right to left, respectively.

Find

[procedure](byte-blob-find NEEDLE HAYSTACK) => LIST

Finds all non-overlapping instances of the byte-blob NEEDLE in the byte-blob HAYSTACK. The first element of the returned list is the prefix of HAYSTACK prior to any matches of NEEDLE. The second is a list of lists.

The first element of each pair in the list is a span from the beginning of a match to the beginning of the next match, while the second is a span from the beginning of the match to the end of the input.

I/O

[procedure](byte-blob-read PORT N) => BYTE-BLOB

Reads a byte-blob of length N from the given port.

[procedure](byte-blob-write PORT BYTE-BLOB) => UNDEFINED

Writes the given byte-blob to the given port.

SRFI-4 transformers

<procedure>(u8vector->byte-blob U8VECTOR) => BYTE-BLOB</procedure>

<procedure>(s8vector->byte-blob S8VECTOR) => BYTE-BLOB</procedure>

<procedure>(u16vector->byte-blob U16VECTOR) => BYTE-BLOB</procedure>

<procedure>(s16vector->byte-blob S16VECTOR) => BYTE-BLOB</procedure>

<procedure>(u32vector->byte-blob U32VECTOR) => BYTE-BLOB</procedure>

<procedure>(s32vector->byte-blob S32VECTOR) => BYTE-BLOB</procedure>

<procedure>(f32vector->byte-blob F32VECTOR) => BYTE-BLOB</procedure>

<procedure>(f64vector->byte-blob F64VECTOR) => BYTE-BLOB</procedure>

<procedure>(byte-blob->u8vector BYTE-BLOB) => U8VECTOR</procedure>

<procedure>(byte-blob->s8vector BYTE-BLOB) => S8VECTOR</procedure>

<procedure>(byte-blob->u16vector BYTE-BLOB) => U16VECTOR</procedure>

<procedure>(byte-blob->s16vector BYTE-BLOB) => S16VECTOR</procedure>

<procedure>(byte-blob->u32vector BYTE-BLOB) => U32VECTOR</procedure>

<procedure>(byte-blob->s32vector BYTE-BLOB) => S32VECTOR</procedure>

<procedure>(byte-blob->f32vector BYTE-BLOB) => F32VECTOR</procedure>

<procedure>(byte-blob->f64vector BYTE-BLOB) => F64VECTOR</procedure>

Version History

1.0 Initial release

License

The code for byte-blob-find is based on code from the Haskell Text library by Tom Harper and Bryan O'Sullivan.

Copyright 2009 Ivan Raikov.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.