diff options
Diffstat (limited to 'lib/scheme/base/30-if.csc')
| -rw-r--r-- | lib/scheme/base/30-if.csc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/scheme/base/30-if.csc b/lib/scheme/base/30-if.csc index 6262f5a..36edc16 100644 --- a/lib/scheme/base/30-if.csc +++ b/lib/scheme/base/30-if.csc @@ -1,13 +1,17 @@ (export and + boolean=? + boolean? case-lambda cond if + not or unless when) (import (only (csc builtins) - builtin-if)) + builtin-if + call-builtin)) (begin @@ -100,4 +104,23 @@ . body) args) (cl . rest)))))) - (cl (params body0 ...) ...)))))))) + (cl (params body0 ...) ...))))))) + + + (define (not obj) + (if obj + #f + #t)) + + + (define (boolean? obj) + (call-builtin eq? 2 (call-builtin typeof obj))) + + + (define (boolean=? b1 b2 . bs) + (and (boolean? b1) + (let loop ((bs (cons b2 bs))) + (or (null? bs) + (and (boolean? (car bs)) + (call-builtin eq? b1 (car bs)) + (loop (cdr bs)))))))) |
