[racket] Bug in TR for/sum: ??
Then your program would change semantics depending on your type
annotations (and potentially be different than the untyped Racket
version). I don't think that's a road we want to go down.
It would be better if `for/sum` let you supply the base case.
On Thu, Mar 28, 2013 at 4:52 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> Perhaps for/sum should adapt its base case answer to the return type?
>
>
>
> On Mar 28, 2013, at 4:03 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>
>> I'm not sure what you're referring to. This program doesn't typecheck,
>> because if both vectors were empty, the result is exact 0, which isn't
>> a `Float`.
>>
>> Sam
>>
>> On Thu, Mar 28, 2013 at 3:56 PM, Ray Racine <ray.racine at gmail.com> wrote:
>>> Is this a bug?
>>>
>>> #lang typed/racket/base
>>>
>>> (define: βns : (Vectorof Float) '#(1.0 2.0 3.0))
>>> (define: χns : (Vectorof Float) '#(4.0 5.0 6.0))
>>>
>>> (for/sum: : Float
>>> ([βn : Float (in-vector βns)]
>>> [χn : Float (in-vector χns)])
>>> (* βn χn))
>>>
>>> ____________________
>>> Racket Users list:
>>> http://lists.racket-lang.org/users
>>>
>>
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
>