<=, >=: take multiple arguments.
This commit is contained in:
parent
b5ab19aab7
commit
e1bfc3e17e
12
scm.mes
12
scm.mes
|
@ -166,13 +166,13 @@
|
|||
(cond (x #f)
|
||||
(#t #t)))
|
||||
|
||||
(define (<= a b) ;; FIXME: only 2 arg
|
||||
(or (< a b)
|
||||
(= a b)))
|
||||
(define (<= . rest)
|
||||
(or (apply < rest)
|
||||
(apply = rest)))
|
||||
|
||||
(define (>= a b) ;; FIXME: only 2 arg
|
||||
(or (> a b)
|
||||
(= a b)))
|
||||
(define (>= . rest)
|
||||
(or (apply > rest)
|
||||
(apply = rest)))
|
||||
|
||||
(define quotient /)
|
||||
|
||||
|
|
6
test.mes
6
test.mes
|
@ -271,6 +271,12 @@
|
|||
(pass-if "> 4" (seq? (> 2 1 0) #t))
|
||||
(pass-if "> 5" (seq? (> 1 2 0) #f))
|
||||
|
||||
(pass-if ">=" (seq? (>= 3 2 1) #t))
|
||||
(pass-if ">= 2" (seq? (>= 1 2 3) #f))
|
||||
|
||||
(pass-if "<=" (seq? (<= 3 2 1) #f))
|
||||
(pass-if "<= 2" (seq? (<= 1 2 3) #t))
|
||||
|
||||
(newline)
|
||||
(display "passed: ") (display (car (result))) (newline)
|
||||
(display "failed: ") (display (cadr (result))) (newline)
|
||||
|
|
Loading…
Reference in a new issue