boot2

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

12-numpred.scm (828B)


      1 ;; Step-10c numeric predicates + numeric functions.
      2 ;;
      3 ;; zero? / positive? / negative? / number? return singletons;
      4 ;; abs / min / max return fixnums. Step 11 brings negative literals
      5 ;; and negative-fixnum printing, so we synthesize negatives here via
      6 ;; `(- 0 n)` / `(bit-not 0)` and witness them through predicates
      7 ;; rather than printing the raw value.
      8 (if (zero? 0)
      9   (if (if (zero? 5) 0 1)
     10     (if (positive? 5)
     11       (if (if (positive? 0) 0 1)
     12         (if (negative? (- 0 3))
     13           (if (if (negative? 5) 0 1)
     14             (if (number? 42)
     15               (if (if (number? (quote x)) 0 1)
     16                 (if (= (abs 7) 7)
     17                   (if (= (abs (- 0 9)) 9)
     18                     (if (= (min 5 3 9 2 8) 2)
     19                       (if (= (max 1 7 4 3) 7)
     20                         42 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0)