Next: , Previous: , Up: bytevectors 8   [Index]


27.2.16 Replicate and rotate

Function: %xsubbytevector-s8 from to str start past
Function: %xsubbytevector-u8 from to str start past
Macro: xsubbytevector-s8 S from to
Macro: xsubbytevector-u8 S from to

Extended subvector procedure replicating the selected subvector “up and down” index space, in both the positive and negative directions.

The call:

(%xsubstring from to 'vu8(0 1 2 3 4 5 6) 3 6)

selects the subvector 3 4 5 and defines the conceptual bidirectionally–infinite bytevector:

...  4  5  3  4  5  3  4  5  3  4  5 ...
... -5 -4 -3 -2 -1  0 +1 +2 +3 +4 +5 ...
                    ^

that is 3 4 5 repeated in both directions. This function returns the subvector of this bytevector beginning at index from, and ending at to.

Note that:

It is an error if start equals past.

Function: xbytevector-s8-xcopy! from to target target-start source source-start source-past
Function: xbytevector-u8-xcopy! from to target target-start source source-start source-past
Macro: bytevector-s8-xcopy! target-B source-B from to
Macro: bytevector-u8-xcopy! target-B source-B from to

Exactly the same as %xsubbytevector-u8, but the extracted data is written into the selected subvector of target.

This operation is not defined if (eq? target start); we cannot copy a bytevector on top of itself.


Next: , Previous: , Up: bytevectors 8   [Index]