boot2

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

14-tagpred.scm (798B)


      1 ;; Step-10c tag predicates + eq?.
      2 ;;
      3 ;; symbol?/string?/vector?/procedure? inspect the tag (and for vector
      4 ;; the header type byte). Strings and vectors don't exist as literals
      5 ;; yet (steps 10e/10f), so their #f case is tested against a fixnum.
      6 ;; `procedure?` accepts both closures and primitives (same tag band).
      7 ;; `eq?` is pointer/value identity — interning makes symbol eq? work.
      8 (if (symbol? (quote foo))
      9   (if (if (symbol? 42) 0 1)
     10     (if (if (string? 42) 0 1)
     11       (if (if (vector? 42) 0 1)
     12         (if (procedure? (lambda (x) x))
     13           (if (procedure? +)
     14             (if (if (procedure? 42) 0 1)
     15               (if (eq? (quote a) (quote a))
     16                 (if (if (eq? (quote a) (quote b)) 0 1)
     17                   (if (eq? 5 5)
     18                     42 0) 0) 0) 0) 0) 0) 0) 0) 0) 0)