scm.mes: remainder.
This commit is contained in:
parent
39d5722973
commit
9fc7868a6d
3
scm.mes
3
scm.mes
|
@ -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))
|
||||||
|
|
3
test.mes
3
test.mes
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue