chickadee » srfi-207 » bytestring

bytestring arg procedure

Converts the args into a sequence of small integers and returns them as a bytevector as follows:

  • If arg is an exact integer in the range 0–255 inclusive, it is added to the result.
  • If arg is an ASCII character (that is, its codepoint is in the range 0–127 inclusive), it is converted to its codepoint and added to the result.
  • If arg is a bytevector, its elements are added to the result.
  • If arg is a string of ASCII characters, it is converted to a sequence of codepoints which are added to the result.

Otherwise, an error satisfying bytestring-error? is signaled.

Examples:

(bytestring "lor" #\r #x65 #u8(#x6d)) ⇒ #u8"lorem"
(bytestring "η" #\space #u8(#x65 #x71 #x75 #x69 #x76)) ⇒ ; error