<=, >=: take multiple arguments.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-24 16:29:38 +02:00
parent b5ab19aab7
commit e1bfc3e17e
2 changed files with 12 additions and 6 deletions

12
scm.mes
View file

@ -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 /)

View file

@ -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)