Add even?, odd?.
* module/mes/scm.mes (even?, odd?): New function.
This commit is contained in:
parent
eb92e77719
commit
898e6a1b6b
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue