boot2

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

083-write-line.scm (536B)


      1 ; write-line writes its bytevector then a single newline byte. Pin the
      2 ; concatenation by writing two short lines and reading the file back.
      3 (define path "/tmp/scheme1-write-line.txt")
      4 
      5 (define op (open-output path))
      6 (if (not (car op)) (exit 10) 0)
      7 (write-line (cdr op) "hello")
      8 (write-line (cdr op) "world")
      9 (close (cdr op))
     10 
     11 (define ip (open-input path))
     12 (if (not (car ip)) (exit 20) 0)
     13 (define rd (read-all (cdr ip)))
     14 (close (cdr ip))
     15 (if (not (car rd)) (exit 30) 0)
     16 
     17 (if (bytevector=? (cdr rd) "hello\nworld\n") (exit 0) (exit 40))