[racket] Another basic TR question
At Thu, 13 Feb 2014 14:45:08 -0500,
Bloch Stephen wrote:
> Don't tell me the Zero I'm running into is the initial value of
> for/sum's hidden accumulator....
Yes, that's where the Zero comes from.
> And even if there were a zero, shouldn't Zero be a subtype of Flonum?
Zero is the type of the exact integer 0, but the Flonum type only
includes floating-point numbers. The two are not related by subtyping.
You can use `assert' to check, at run-time, that you do always get a
Flonum:
(assert (for/sum: : Real [[ii : Index 300]]
pi)
flonum?)
This expression typechecks at type Flonum.
Vincent