Simplify the type of zero?.
This commit is contained in:
parent
be225976d3
commit
7b762933c6
|
@ -891,12 +891,8 @@
|
|||
;; There are 25 values that answer true to zero?. They are either reals, or inexact complexes.
|
||||
;; Note -RealZero contains NaN and zero? returns #f on it
|
||||
[zero?
|
||||
(cl->*
|
||||
(-> -ExactNumber B : (-FS (-filter (-val 0) 0) (-not-filter (-val 0) 0)))
|
||||
(-> -Real B : (-FS (-filter -RealZero 0)
|
||||
(-not-filter (Un -Zero -InexactRealPosZero -InexactRealNegZero) 0)))
|
||||
(-> N B : (-FS (-filter (Un -RealZero -InexactComplex -InexactImaginary) 0)
|
||||
(-not-filter (Un -Zero -InexactRealPosZero -InexactRealNegZero) 0))))]
|
||||
(-> N B : (-FS (-filter (Un -RealZero -InexactComplex -InexactImaginary) 0)
|
||||
(-not-filter (Un -Zero -InexactRealPosZero -InexactRealNegZero) 0)))]
|
||||
|
||||
[number? (make-pred-ty N)]
|
||||
[integer? (asym-pred Univ B (-FS (-filter (Un -Int -Flonum -SingleFlonum) 0) ; inexact-integers exist...
|
||||
|
|
|
@ -2058,7 +2058,7 @@
|
|||
(-lst -Symbol)]
|
||||
[tc-e (sequence-count zero? (inst empty-sequence Integer))
|
||||
-Nat]
|
||||
[tc-e (sequence-filter zero? (inst empty-sequence Integer))
|
||||
[tc-e ((inst sequence-filter Integer Zero) zero? (inst empty-sequence Integer))
|
||||
(-seq (-val 0))]
|
||||
[tc-e (sequence-add-between (inst empty-sequence Integer) 'foo)
|
||||
(-seq (t:Un -Int (-val 'foo)))]
|
||||
|
@ -3570,6 +3570,16 @@
|
|||
[tc-e/t
|
||||
(lambda: ([x : Real-Zero]) (or (zero? x) x))
|
||||
(t:-> -RealZero (t:Un (-val #t) -InexactRealNan) : -true-filter)]
|
||||
[tc-e/t
|
||||
(lambda: ([x : Positive-Integer]) (zero? x))
|
||||
(t:-> -PosInt -Boolean : -false-filter)]
|
||||
[tc-e/t
|
||||
(lambda: ([x : Natural]) (zero? x))
|
||||
(t:-> -Nat -Boolean : (-FS (-filter (-val 0) 0) (-not-filter (-val 0) 0)))]
|
||||
[tc-e/t
|
||||
(lambda: ([x : Real]) (zero? x))
|
||||
(t:-> -Real -Boolean : (-FS (-filter -RealZero 0)
|
||||
(-not-filter (t:Un -Zero -InexactRealPosZero -InexactRealNegZero) 0)))]
|
||||
|
||||
[tc-e/t (lambda: ([x : Byte]) (positive? x))
|
||||
(t:-> -Byte -Boolean : (-FS (-filter -PosByte 0) (-filter -Zero 0)))]
|
||||
|
@ -3586,6 +3596,8 @@
|
|||
[tc-e/t (lambda: ([x : Flonum]) (or (>= +inf.f x) x))
|
||||
(t:-> -Flonum (t:Un (-val #t) -FlonumNan)
|
||||
: -true-filter)]
|
||||
|
||||
|
||||
)
|
||||
|
||||
(test-suite
|
||||
|
|
Loading…
Reference in New Issue
Block a user