- (bytestring-replicate bytevector from to [start end])procedure
This is an "extended substring" procedure that implements replicated copying of a subbytestring.
The subvector of bytevector described by start and end (the whole bytevector, by default) is conceptually replicated both up and down the index space, in both the positive and negative directions, to produce a conceptually infinite bytevector. The subvector from from to to of this bytevector is returned.
Note that
- The from/to arguments give a half-open range containing the characters from index from up to, but not including, index to.
- The from/to indexes are not expressed in the index space of bytevector. They refer instead to the replicated index space of the substring defined by bytevector, start, and end.
(Extension based on string-replicate from srfi-152 (AKA xsubstring from srfi-13).)
;; Rotate left. (bytestring-replicate #u8"abcdef" 1 7) ⇒ #u8"bcdefa" ;; Rotate right. (bytestring-replicate #u8"abcdef" -1 5) ⇒ #u8"fabcde" ;; Iterative copy. (bytestring-replicate #u8".oOo" 0 12) ⇒ #u8".oOo.oOo.oOo."