Skip to content

Constructors

Scheme Procedure: bytestring part …

Converts earch part into a sequence of small integers and returns a bytevector of the corresponding bytes as follows:

  • If part is an exact integer in the range 0-255 inclusive, it is added to the result.
  • If part 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 part is a bytevector, its elements are added to the result.
  • If part 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, for example:

emacs-lisp
(bytestring "lo" #\r #x65 #u8(#x6d)) ⇒ #u8"lorem"
emacs-lisp
(bytestring "η" #\space #u8(#x65 #x71 #x75 #x69 #x76))
⇒ raised &bytestring-error

Scheme Procedure: make-bytestring parts

If the parts are suitable arguments for bytestring, returns the bytevector that would result from applying bytestring to them. Otherwise, an error satisfying bytestring-error? is raised.

Scheme Procedure: make-bytestring! bytevector at parts

If the parts are suitable arguments for bytestring, writes the bytes of the bytevector that would be the result of calling make-bytestring into bytevector starting at index at. For example:

emacs-lisp
(define bv (make-bytevector 10 #x20))
(make-bytestring! bv 2 '(#\s #\c "he" #u8(#x6d #x65))) bv)
#u8" scheme "