scm.mes: remainder.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-24 17:11:49 +02:00
parent 39d5722973
commit 9fc7868a6d
2 changed files with 6 additions and 0 deletions

View file

@ -182,6 +182,9 @@
(define quotient /) (define quotient /)
(define (remainder x y)
(- x (* (/ x y) y)))
(define (max x . rest) (define (max x . rest)
(if (null? rest) x (if (null? rest) x
(let* ((y (car rest)) (let* ((y (car rest))

View file

@ -102,6 +102,9 @@
(pass-if "+" (seq? (+ 1 2 3) 6)) (pass-if "+" (seq? (+ 1 2 3) 6))
(pass-if "*" (seq? (* 3 3 3) 27)) (pass-if "*" (seq? (* 3 3 3) 27))
(pass-if "/" (seq? (/ 9 3) 3)) (pass-if "/" (seq? (/ 9 3) 3))
(pass-if "remainder" (seq? (remainder 11 3) 2))
(pass-if "modulo" (seq? (modulo 11 3) 2))
(pass-if "=" (seq? 3 '3)) (pass-if "=" (seq? 3 '3))
(pass-if "= 2" (not (= 3 '4))) (pass-if "= 2" (not (= 3 '4)))
(pass-if "if" (seq? (if #t 'true) 'true)) (pass-if "if" (seq? (if #t 'true) 'true))