<=, >=: 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)
|
(cond (x #f)
|
||||||
(#t #t)))
|
(#t #t)))
|
||||||
|
|
||||||
(define (<= a b) ;; FIXME: only 2 arg
|
(define (<= . rest)
|
||||||
(or (< a b)
|
(or (apply < rest)
|
||||||
(= a b)))
|
(apply = rest)))
|
||||||
|
|
||||||
(define (>= a b) ;; FIXME: only 2 arg
|
(define (>= . rest)
|
||||||
(or (> a b)
|
(or (apply > rest)
|
||||||
(= a b)))
|
(apply = rest)))
|
||||||
|
|
||||||
(define quotient /)
|
(define quotient /)
|
||||||
|
|
||||||
|
|
6
test.mes
6
test.mes
|
@ -271,6 +271,12 @@
|
||||||
(pass-if "> 4" (seq? (> 2 1 0) #t))
|
(pass-if "> 4" (seq? (> 2 1 0) #t))
|
||||||
(pass-if "> 5" (seq? (> 1 2 0) #f))
|
(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)
|
(newline)
|
||||||
(display "passed: ") (display (car (result))) (newline)
|
(display "passed: ") (display (car (result))) (newline)
|
||||||
(display "failed: ") (display (cadr (result))) (newline)
|
(display "failed: ") (display (cadr (result))) (newline)
|
||||||
|
|
Loading…
Reference in a new issue