Add negative?, positive?, zero?, 1+ 1-.
* module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions.
This commit is contained in:
parent
376435e974
commit
d7d46b9546
|
@ -157,6 +157,21 @@
|
||||||
(define (odd? x)
|
(define (odd? x)
|
||||||
(= 1 (remainder x 2)))
|
(= 1 (remainder x 2)))
|
||||||
|
|
||||||
|
(define (negative? x)
|
||||||
|
(< x 0))
|
||||||
|
|
||||||
|
(define (positive? x)
|
||||||
|
(> x 0))
|
||||||
|
|
||||||
|
(define (zero? x)
|
||||||
|
(= x 0))
|
||||||
|
|
||||||
|
(define (1+ x)
|
||||||
|
(+ x 1))
|
||||||
|
|
||||||
|
(define (1- x)
|
||||||
|
(- x 1))
|
||||||
|
|
||||||
(define (expt x y)
|
(define (expt x y)
|
||||||
(let loop ((s 1) (count y))
|
(let loop ((s 1) (count y))
|
||||||
(if (= 0 count) s
|
(if (= 0 count) s
|
||||||
|
|
Loading…
Reference in a new issue