Add even?, odd?.

* module/mes/scm.mes (even?, odd?): New function.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-20 10:41:39 +01:00
parent eb92e77719
commit 898e6a1b6b

View file

@ -151,6 +151,12 @@
(define (remainder x y)
(- x (* (quotient x y) y)))
(define (even? x)
(= 0 (remainder x 2)))
(define (odd? x)
(= 1 (remainder x 2)))
(define (expt x y)
(let loop ((s 1) (count y))
(if (= 0 count) s