chickadee » srfi-207 » bytestring-join

bytestring-join bytevector-list delimiter #!optional grammarprocedure

Pastes the bytevectors in bytevector-list together using the delimiter, which can be anything suitable as an argument to bytestring. The grammar argument is a symbol that determines how the delimiter is used, and defaults to infix. It is an error for grammar to be any symbol other than these four:

  • infix means an infix or separator grammar: inserts the delimiter between list elements. An empty list will produce an empty bytevector.
  • strict-infix means the same as infix if the list is non-empty, but will signal an error satisfying bytestring-error? if given an empty list.
  • suffix means a suffix or terminator grammar: inserts the delimiter after every list element.
  • prefix means a prefix grammar: inserts the delimiter before every list element.
(bytestring-join '(#u8"Heart" #u8"of" #u8"Gold") #x20) ⇒ #u8"Heart of Gold"
(bytestring-join '(#u8(#xef #xbb) #u8(#xbf)) 0 'prefix) ⇒ #u8(0 #xef #xbb 0 #xbf)
(bytestring-join '() 0 'strict-infix) ⇒ ; error