boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

052-string-literal.scm (573B)


      1 ; String literals have their own length-bearing type.  Boot2 bytevector
      2 ; operations can still inspect their encoded bytes.
      3 (define s "abc")
      4 (if (string? s) 0 (sys-exit 1))
      5 (if (not (bytevector? s)) 0 (sys-exit 2))
      6 (if (bytes? s) 0 (sys-exit 3))
      7 (if (= (string-length s) 3) 0 (sys-exit 4))
      8 (if (= (bytevector-length s) 3) 0 (sys-exit 5))
      9 (if (= (bytevector-u8-ref s 0) 97) 0 (sys-exit 6))   ; 'a'
     10 (if (= (bytevector-u8-ref s 1) 98) 0 (sys-exit 7))   ; 'b'
     11 (if (= (bytevector-u8-ref s 2) 99) 0 (sys-exit 8))   ; 'c'
     12 (if (= (string-length "") 0) 0 (sys-exit 9))
     13 (sys-exit 0)