* moving all tag predicates to their own library (ikarus predicates)

This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 03:24:33 -04:00
parent 39dd690164
commit 2931c3e769
5 changed files with 58 additions and 63 deletions

Binary file not shown.

View File

@ -49,15 +49,8 @@
(error 'fxlognot "~s is not a fixnum" x)) (error 'fxlognot "~s is not a fixnum" x))
($fxlognot x))) ($fxlognot x)))
(primitive-set! 'fixnum? (lambda (x) (fixnum? x)))
(primitive-set! 'immediate? (lambda (x) (immediate? 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! 'boolean? (lambda (x) (boolean? x)))
(primitive-set! 'char? (lambda (x) (char? x))) (primitive-set! 'char? (lambda (x) (char? x)))

View File

@ -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) (library (ikarus fixnums)
(export fxzero?) (export fxzero?)

57
src/ikarus.predicates.ss Normal file
View File

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

View File

@ -23,6 +23,7 @@
;;; ;;;
'("ikarus.handlers.ss" '("ikarus.handlers.ss"
"ikarus.multiple-values.ss" "ikarus.multiple-values.ss"
"ikarus.predicates.ss"
"ikarus.control.ss" "ikarus.control.ss"
"ikarus.collect.ss" "ikarus.collect.ss"
"ikarus.records.ss" "ikarus.records.ss"