diff --git a/src/ikarus.boot b/src/ikarus.boot index 68deeff..c652cb0 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.core.ss b/src/ikarus.core.ss index d40550c..b4fbf94 100644 --- a/src/ikarus.core.ss +++ b/src/ikarus.core.ss @@ -49,15 +49,8 @@ (error 'fxlognot "~s is not a fixnum" x)) ($fxlognot x))) -(primitive-set! 'fixnum? (lambda (x) (fixnum? x))) (primitive-set! 'immediate? (lambda (x) (immediate? x))) -(primitive-set! 'fxzero? - (lambda (x) - (unless (fixnum? x) - (error 'fxzero? "~s is not a fixnum" x)) - ($fxzero? x))) - (primitive-set! 'boolean? (lambda (x) (boolean? x))) (primitive-set! 'char? (lambda (x) (char? x))) diff --git a/src/ikarus.numerics.ss b/src/ikarus.numerics.ss index 4ac775b..d7b04db 100644 --- a/src/ikarus.numerics.ss +++ b/src/ikarus.numerics.ss @@ -1,62 +1,6 @@ -(library (ikarus numeric predicates) - (export fixnum? flonum? bignum? number? complex? real? rational? - integer? exact?) - (import - (except (ikarus) fixnum? flonum? bignum? number? complex? real? - rational? integer? exact?) - (rename (only (ikarus) fixnum? flonum? bignum?) - (fixnum? sys:fixnum?) - (flonum? sys:flonum?) - (bignum? sys:bignum?))) - - (define fixnum? - (lambda (x) (sys:fixnum? x))) - - (define bignum? - (lambda (x) (sys:bignum? x))) - - (define flonum? - (lambda (x) (sys:flonum? x))) - - (define number? - (lambda (x) - (or (sys:fixnum? x) - (sys:bignum? x) - (sys:flonum? x)))) - - (define complex? - (lambda (x) (number? x))) - - (define real? - (lambda (x) (number? x))) - - (define rational? - (lambda (x) - (cond - [(sys:fixnum? x) #t] - [(sys:bignum? x) #t] - [(sys:flonum? x) #f] - [else (error 'rational? "~s is not a number" x)]))) - - (define integer? - (lambda (x) - (cond - [(sys:fixnum? x) #t] - [(sys:bignum? x) #t] - [(sys:flonum? x) (error 'integer "dunno for ~s" x)] - [else #f]))) - - (define exact? - (lambda (x) - (cond - [(sys:fixnum? x) #t] - [(sys:bignum? x) #t] - [(sys:flonum? x) #f] - [else - (error 'exact? "~s is not a number" x)])))) (library (ikarus fixnums) (export fxzero?) diff --git a/src/ikarus.predicates.ss b/src/ikarus.predicates.ss new file mode 100644 index 0000000..969e81f --- /dev/null +++ b/src/ikarus.predicates.ss @@ -0,0 +1,57 @@ + +(library (ikarus predicates) + (export fixnum? flonum? bignum? number? complex? real? rational? + integer? exact?) + (import + (except (ikarus) fixnum? flonum? bignum? number? complex? real? + rational? integer? exact?) + (rename (only (ikarus) fixnum? flonum? bignum?) + (fixnum? sys:fixnum?) + (flonum? sys:flonum?) + (bignum? sys:bignum?))) + + (define fixnum? + (lambda (x) (sys:fixnum? x))) + + (define bignum? + (lambda (x) (sys:bignum? x))) + + (define flonum? + (lambda (x) (sys:flonum? x))) + + (define number? + (lambda (x) + (or (sys:fixnum? x) + (sys:bignum? x) + (sys:flonum? x)))) + + (define complex? + (lambda (x) (number? x))) + + (define real? + (lambda (x) (number? x))) + + (define rational? + (lambda (x) + (cond + [(sys:fixnum? x) #t] + [(sys:bignum? x) #t] + [(sys:flonum? x) #f] + [else (error 'rational? "~s is not a number" x)]))) + + (define integer? + (lambda (x) + (cond + [(sys:fixnum? x) #t] + [(sys:bignum? x) #t] + [(sys:flonum? x) (error 'integer "dunno for ~s" x)] + [else #f]))) + + (define exact? + (lambda (x) + (cond + [(sys:fixnum? x) #t] + [(sys:bignum? x) #t] + [(sys:flonum? x) #f] + [else + (error 'exact? "~s is not a number" x)])))) diff --git a/src/makefile.ss b/src/makefile.ss index 7399fef..df0c26a 100755 --- a/src/makefile.ss +++ b/src/makefile.ss @@ -23,6 +23,7 @@ ;;; '("ikarus.handlers.ss" "ikarus.multiple-values.ss" + "ikarus.predicates.ss" "ikarus.control.ss" "ikarus.collect.ss" "ikarus.records.ss"