Add negative?, positive?, zero?, 1+ 1-.

* module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions.
This commit is contained in:
Jan Nieuwenhuizen 2016-12-20 10:57:09 +01:00
parent 376435e974
commit d7d46b9546
1 changed files with 15 additions and 0 deletions

View File

@ -157,6 +157,21 @@
(define (odd? x)
(= 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)
(let loop ((s 1) (count y))
(if (= 0 count) s