Re: [racket] Another basic TR question

2014-02-14 Thread Sam Tobin-Hochstadt
On Fri, Feb 14, 2014 at 10:51 AM, Vincent St-Amour wrote: > >> And while I've got your attention... >> >> When I tried the same thing with a smaller limit, e.g. >> >> > (for/sum: : Flonum [[ii : Index 8]] >> > pi) >> >> I got not only the aforementioned complaint about Zero but also a >> complain

Re: [racket] Another basic TR question

2014-02-14 Thread Vincent St-Amour
At Thu, 13 Feb 2014 19:08:16 -0500, Stephen Bloch wrote: > > Aha. You don't want to initialize to something inexact, because then > the sum of a bunch of exact things would be contaminated with > inexactness. And the only exact zero you've got isn't a Flonum. Exactly. > I suppose one could inv

Re: [racket] Another basic TR question

2014-02-13 Thread Bloch Stephen
And while I've got your attention... When I tried the same thing with a smaller limit, e.g. > (for/sum: : Flonum [[ii : Index 8]] > pi) I got not only the aforementioned complaint about Zero but also a complaint that it expected Index, but got Byte (presumably it decided 8 was small enough to

Re: [racket] Another basic TR question

2014-02-13 Thread Vincent St-Amour
At Thu, 13 Feb 2014 16:22:35 -0500, Bloch Stephen wrote: > > [1 ] > [1.1 ] > [1.1.1 ] > > On Feb 13, 2014, at 2:51 PM, Sam Tobin-Hochstadt wrote: > > >> (for/sum: : Flonum [[ii : Index 300]] > >> pi) > >> > >> and I get the type error "Expected Flonum, but got Zero". Where is there a > >>

Re: [racket] Another basic TR question

2014-02-13 Thread Bloch Stephen
On Feb 13, 2014, at 2:56 PM, Vincent St-Amour wrote: > 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,

Re: [racket] Another basic TR question

2014-02-13 Thread Bloch Stephen
On Feb 13, 2014, at 2:51 PM, Sam Tobin-Hochstadt wrote: >> (for/sum: : Flonum [[ii : Index 300]] >> pi) >> >> and I get the type error "Expected Flonum, but got Zero". Where is there a >> zero anywhere in this code? And even if there were a zero, shouldn't Zero >> be a subtype of Flonum? >>

Re: [racket] Another basic TR question

2014-02-13 Thread Vincent St-Amour
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 exa

Re: [racket] Another basic TR question

2014-02-13 Thread Sam Tobin-Hochstadt
On Thu, Feb 13, 2014 at 2:45 PM, Bloch Stephen wrote: > I've removed a lot of possibly-irrelevant stuff and boiled my current > obstacle down to the following: > > In #lang racket, the following works fine: > > (for/sum [[ii 300]] > pi) > > > > In #lang typed/racket, I try to do the same thing:

[racket] Another basic TR question

2014-02-13 Thread Bloch Stephen
I've removed a lot of possibly-irrelevant stuff and boiled my current obstacle down to the following: In #lang racket, the following works fine: (for/sum [[ii 300]] pi) In #lang typed/racket, I try to do the same thing: (for/sum: : Flonum [[ii : Index 300]] pi) and I get the type error