10-arith.scm (678B)
1 ;; Step-10c arithmetic primitives: + - * / %. 2 ;; 3 ;; `+` and `*` are variadic (identity on 0 args); `-` folds left; `/` 4 ;; and `%` are strictly binary (signed truncating divide and remainder, 5 ;; matching SARI + DIV/REM semantics). The nested `if` ladder exits 6 ;; with the witness fixnum 42 only when every check holds; a single 7 ;; wrong primitive short-circuits to 0 and the diff fails loudly. 8 (if (= (+) 0) 9 (if (= (+ 7) 7) 10 (if (= (+ 1 2 3 4) 10) 11 (if (= (*) 1) 12 (if (= (* 6) 6) 13 (if (= (* 2 3 4) 24) 14 (if (= (- 10 3 2) 5) 15 (if (= (/ 100 5) 20) 16 (if (= (% 17 5) 2) 17 42 0) 0) 0) 0) 0) 0) 0) 0) 0)