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.

Version History

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 and the Okinawa Institute of Science and Technology.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.