Re: [racket] weird typed racket error

2014-07-14 Thread Alexander D. Knauth
On Jul 14, 2014, at 10:19 AM, Sam Tobin-Hochstadt wrote: > This version with `for/fold` works for me: > > (for/fold : (U Index #f) ([k : (U Index #f) #f]) > ([i : Index (ann (in-range 5) (Sequenceof Index))]) > i) I’m not sure what it was then, because I just tried for/fold again and it wor

Re: [racket] weird typed racket error

2014-07-14 Thread Sam Tobin-Hochstadt
This version with `for/fold` works for me: (for/fold : (U Index #f) ([k : (U Index #f) #f]) ([i : Index (ann (in-range 5) (Sequenceof Index))]) i) Sam On Sun, Jul 13, 2014 at 11:15 PM, Alexander D. Knauth wrote: > > On Jul 13, 2014, at 8:23 PM, Sam Tobin-Hochstadt wrote: > >> Probably, wha

Re: [racket] weird typed racket error

2014-07-13 Thread Alexander D. Knauth
On Jul 13, 2014, at 8:23 PM, Sam Tobin-Hochstadt wrote: > Probably, what's going on here is that `for/last` has a hidden loop > variable that starts off as `#f` and Typed Racket infers that to have > type `False`. I thought that was the whole point of adding the : (U Index #f), right? To prov

Re: [racket] weird typed racket error

2014-07-13 Thread Sam Tobin-Hochstadt
Probably, what's going on here is that `for/last` has a hidden loop variable that starts off as `#f` and Typed Racket infers that to have type `False`. If that's the case, there's nothing you can really do other than rewrite this as `for/fold`. Sam On Sun, Jul 13, 2014 at 7:57 PM, Alexander D. K

Re: [racket] Weird typed racket error

2014-04-19 Thread Neil Toronto
On 04/19/2014 09:43 PM, Alexander D. Knauth wrote: On Apr 19, 2014, at 10:44 PM, Neil Toronto mailto:neil.toro...@gmail.com>> wrote: That is weird. It works in the nightly build without annotating anything but `sphere3d`, and likely in the next release as well. Keyword arguments haven't been a

Re: [racket] Weird typed racket error

2014-04-19 Thread Alexander D. Knauth
On Apr 19, 2014, at 10:44 PM, Neil Toronto wrote: > That is weird. It works in the nightly build without annotating anything but > `sphere3d`, and likely in the next release as well. Keyword arguments haven't > been all that well-supported in the past, so I'd try making the arguments to > sph

Re: [racket] Weird typed racket error

2014-04-19 Thread Alexander D. Knauth
On Apr 19, 2014, at 10:44 PM, Neil Toronto wrote: > That is weird. It works in the nightly build without annotating anything but > `sphere3d`, and likely in the next release as well. Keyword arguments haven't > been all that well-supported in the past, so I'd try making the arguments to > sp

Re: [racket] Weird typed racket error

2014-04-19 Thread Alexander D. Knauth
When I take out the #{} annotations, it gives me 24 errors (with some repeated) instead of just 6: (that’s the reason I put them there in the first place) (: sphere3d (#:posn (Vectorof Real) #:r Nonnegative-Real [#:color Plot-Color] -> renderer3d)) (define (sphere3d #:posn ctr.posn #:r r #:color

Re: [racket] Weird typed racket error

2014-04-19 Thread Greg Hendershott
Oh, Neil's post arrived just as mine went out. I'm using Racket HEAD. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Weird typed racket error

2014-04-19 Thread Neil Toronto
That is weird. It works in the nightly build without annotating anything but `sphere3d`, and likely in the next release as well. Keyword arguments haven't been all that well-supported in the past, so I'd try making the arguments to sphere3d positional instead. FWIW, the easiest way to destruct

Re: [racket] Weird typed racket error

2014-04-19 Thread Greg Hendershott
I think you don't want those #{} annotations in the function definition: > (define (sphere3d #:posn #{ctr.posn : (Vectorof Real)} #:r #{r : > Nonnegative-Real} #:color [#{color : Plot-Color} "black"]) The following typechecks OK for me: (define (sphere3d #:posn ctr.posn #:r r #:color [color "bla