Cleanup of exposed base types.

original commit: 22391be437d61fbbe7a1f19b2a2ded393b7afb55
This commit is contained in:
Vincent St-Amour 2011-01-20 11:28:34 -05:00
parent 97d8f2613c
commit 185e8c4d0b
2 changed files with 45 additions and 17 deletions

View File

@ -16,17 +16,34 @@
[Nonpositive-Inexact-Real -NonPosInexactReal]
[Nonpositive-Single-Flonum -NonPosSingleFlonum]
[Negative-Inexact-Real -NegInexactReal]
[Negative-Single-Flonum -NegSingleFlonum]
[Nonnegative-Inexact-Real -NonNegInexactReal]
[Nonnegative-Single-Flonum -NonNegSingleFlonum]
[Positive-Inexact-Real -PosInexactReal]
[Positive-Single-Flonum -PosSingleFlonum]
[Inexact-Real-Zero -InexactRealZero]
[Inexact-Real-Negative-Zero -InexactRealNegZero]
[Inexact-Real-Positive-Zero -InexactRealPosZero]
[Single-Flonum-Zero -SingleFlonumZero]
[Float -Flonum] ; these are the default, 64-bit floats, can be optimized
[Nonpositive-Float -NonPosFlonum]
[Nonnegative-Float -NonNegFlonum]
[Float-Zero -FlonumZero]
[Single-Flonum-Negative-Zero -SingleFlonumNegZero]
[Single-Flonum-Positive-Zero -SingleFlonumPosZero]
;; these are the default, 64-bit floats, can be optimized
[Float -Flonum] ; both of these are valid
[Flonum -Flonum]
[Nonpositive-Float -NonPosFlonum] ; both of these are valid
[Nonpositive-Flonum -NonPosFlonum]
[Negative-Float -NegFlonum] ; both of these are valid
[Negative-Flonum -NegFlonum]
[Nonnegative-Float -NonNegFlonum] ; both of these are valid
[Nonnegative-Flonum -NonNegFlonum]
[Positive-Float -PosFlonum] ; both of these are valid
[Positive-Flonum -PosFlonum]
[Float-Zero -FlonumZero] ; both of these are valid
[Flonum-Zero -FlonumZero]
[Float-Negative-Zero -FlonumNegZero] ; both of these are valid
[Flonum-Negative-Zero -FlonumNegZero]
[Float-Positive-Zero -FlonumPosZero] ; both of these are valid
[Flonum-Positive-Zero -FlonumPosZero]
[Exact-Rational -Rat]
[Nonpositive-Exact-Rational -NonPosRat]
[Negative-Exact-Rational -NegRat]

View File

@ -7,13 +7,34 @@
unstable/function
(for-template racket/base racket/contract racket/flonum (types numeric-predicates)))
(provide (all-defined-out))
(provide portable-fixnum? portable-index?
-Zero -One -PosByte -Byte -PosIndex -Index
-PosFixnum -NonNegFixnum -NegFixnum -NonPosFixnum -Fixnum
-PosInt -Nat -NegInt -NonPosInt -Int
-PosRat -NonNegRat -NegRat -NonPosRat -Rat
-FlonumPosZero -FlonumNegZero -FlonumZero -PosFlonum -NonNegFlonum -NegFlonum -NonPosFlonum -Flonum
-SingleFlonumPosZero -SingleFlonumNegZero -SingleFlonumZero -PosSingleFlonum -NonNegSingleFlonum -NegSingleFlonum -NonPosSingleFlonum -SingleFlonum
-InexactRealPosZero -InexactRealNegZero -InexactRealZero -PosInexactReal -NonNegInexactReal -NegInexactReal -NonPosInexactReal -InexactReal
-RealZero -PosReal -NonNegReal -NegReal -NonPosReal -Real
-FloatComplex -SingleFlonumComplex -InexactComplex -Number
;; for backward compatibility
(rename-out [-NonNegFlonum -NonnegativeFlonum]
[-Rat -ExactRational]
[-Int -Integer]
[-PosInt -ExactPositiveInteger]
[-PosFixnum -PositiveFixnum]
[-NegFixnum -NegativeFixnum]
[-NonNegFixnum -NonnegativeFixnum]
[-Nat -ExactNonnegativeInteger]))
;; Numeric hierarchy
;; All built as unions of non-overlapping base types.
;; This should make encoding mathematical properties in the base env easier.
;; Most of the weird base types will probably never be exposed to the user
;; and some probably won't show up in the base env either.
;; The base types that don't have an interesting mathematical meaning
;; (e.g. -Byte>1, -PosFixnumNotIndex, etc.) should not be used anywhere, as
;; they should not be exposed to the user and could easily be misused in
;; the base type environment. They are not provided.
;; A lot of these contracts will be overriden in type->contract, so their
;; hairiness should not be of much consequence.
@ -223,13 +244,3 @@
#'-ExactComplexNotReal))
(define -Complex (*Un -Real -InexactComplex -ExactComplexNotReal))
(define -Number -Complex)
;; TODO for compatibility
(define -NonnegativeFlonum -NonNegFlonum)
(define -ExactRational -Rat)
(define -Integer -Int)
(define -ExactPositiveInteger -PosInt)
(define -PositiveFixnum -PosFixnum)
(define -NegativeFixnum -NegFixnum)
(define -NonnegativeFixnum -NonNegFixnum)
(define -ExactNonnegativeInteger -Nat)