diff --git a/scm.mes b/scm.mes index 0c14d501..eb7f1c82 100755 --- a/scm.mes +++ b/scm.mes @@ -182,6 +182,9 @@ (define quotient /) +(define (remainder x y) + (- x (* (/ x y) y))) + (define (max x . rest) (if (null? rest) x (let* ((y (car rest)) diff --git a/test.mes b/test.mes index ac2f601f..771c5724 100644 --- a/test.mes +++ b/test.mes @@ -102,6 +102,9 @@ (pass-if "+" (seq? (+ 1 2 3) 6)) (pass-if "*" (seq? (* 3 3 3) 27)) (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 "= 2" (not (= 3 '4))) (pass-if "if" (seq? (if #t 'true) 'true))