boot2

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

075-signed-int.scm (499B)


      1 ; Decimal int literals with explicit sign. The reader treats `+`/`-`
      2 ; followed by a digit as a numeric prefix; lone `+` and `-` remain
      3 ; valid identifiers (they are bound to the arithmetic primitives).
      4 (if (= +0   0) 0 (sys-exit 1))
      5 (if (= +7   7) 0 (sys-exit 2))
      6 (if (= -7  -7) 0 (sys-exit 3))
      7 (if (= +42 42) 0 (sys-exit 4))
      8 (if (= -42 (- 0 42)) 0 (sys-exit 5))
      9 ; Lone `+` / `-` are still the arithmetic primitives.
     10 (if (= (+ 3 4) 7) 0 (sys-exit 6))
     11 (if (= (- 9 2) 7) 0 (sys-exit 7))
     12 (sys-exit 0)