Next: bytevectors 8 select, Previous: bytevectors 8 case, Up: bytevectors 8 [Index]
The fundamental bytevector iterator. The bytevector arguments must have the same length.
kons is iterated left–to–right over each index in all of the bytevectors, stopping at the end of the shortest; kons is applied as:
(kons idx state (bytevector-u8-ref bv0 idx) (bytevector-u8-ref bv idx) ยทยทยท)
where state is the current state value; the current state value begins with knil, and becomes whatever kons returned at the respective iteration; idx is the current index.
bytevector-u8-fold-right
is similar to bytevector-u8-fold
, but it
iterates right–to–left.
Notice that to allow for an unspecified number of arguments, these folds hand the state as first argument to kons, as opposed to the usual fold arguments.
Like bytevector-u8-fold
and bytevector-u8-unfold
but
accept bytevectors of different length, iterating until the end of the
shortest one.
Fundamental iterators for subvectors. kons is iterated over each byte of the selected subvector:
(kons (bytevector-u8-ref bv (+ start idx)) state)
where state is the current state value; the current state value begins with knil, and becomes whatever kons returned at the respective iteration; idx is the current index.
The left–fold iterator, %subbytevector-u8-fold-left
, builds the return
value as:
(kons (bytevector-u8-ref bv (- past 1)) (kons (bytevector-u8-ref bv (- past 2)) ... (kons (bytevector-u8-ref bv (+ start 2)) (kons (bytevector-u8-ref bv (+ start 1)) (kons (bytevector-u8-ref bv start) knil)))))
The right–fold iterator, %subbytevector-u8-fold-right
, builds the
return value as:
(kons (bytevector-u8-ref bv start (kons (bytevector-u8-ref bv (+ start 1)) ... (kons (bytevector-u8-ref bv (- past 3)) (kons (bytevector-u8-ref bv (- past 2)) (kons (bytevector-u8-ref bv (- past 1)) knil)))))
This is a fundamental constructor for bytevectors. Arguments description follows.
A map function used to generate a series of “seed” values from the initial seed:
first-seed (make-seed first-seed) ⇒ seed2 (make-seed seed2) ⇒ seed3 (make-seed seed3) ⇒ seed4 ...
A predicate function telling when to stop generating bytes; when it returns true when applied to one of the seed values.
Map function mapping each seed value to the corresponding byte in the result bytevector. These bytes are assembled into the bytevector in a left–to–right order.
An optional bytevector which is used as initial/leftmost portion of the constructed bytevector. Defaults to the empty bytevector.
Optional function applied to the terminal seed value (on which
stop? returns true) to produce the final/rightmost portion of the
constructed bytevector. Defaults to (lambda (x) "")
.
The final bytevector constructed does not share storage with either base-bv or the value produced by make-final.
This is a fundamental constructor for bytevectors. The arguments are like
the ones of bytevector-u8-unfold
. The difference from
bytevector-u8-unfold
is that this function builds the bytevector from right
to left.
The final bytevector constructed does not share storage with either base-bv or the value produced by make-final.
Next: bytevectors 8 select, Previous: bytevectors 8 case, Up: bytevectors 8 [Index]