[racket] typing a function
On 11/23/2012 02:29 AM, Pierpaolo Bernardi wrote:
> Hi,
>
> On Thu, Nov 22, 2012 at 4:41 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
>> On 11/22/2012 07:41 AM, Pierpaolo Bernardi wrote:
>
>> With a few tweaks, it works in 5.3.1. It *will not work* in 5.3, because we
>> hadn't fixed `for/vector:' yet.
>
>> #lang typed/racket
>>
>> (define-type Array2 (Vectorof (Vectorof Number)))
>>
>> (: make-array (Positive-Index Positive-Index -> Array2))
>> (define (make-array xdim ydim)
>> (for/vector: : Array2 ((i (in-range xdim)))
>> (ann (make-vector ydim 0) (Vectorof Number))))
>
> This version does not work in 5.3.1 in the same way as in 5.3.
>
> Maybe it needs the current snapshots?
>
>> One extra thing `for/vector:' has in 5.3.1 is body annotations, and using it
>> makes the extra annotation unnecessary:
>>
>> (for/vector: ((i (in-range xdim))) : (Vectorof Number)
>> (make-vector ydim 0))
>
> This syntax isn't even parsed in 5.3.1.
Oh, no! I'm really sorry about having you take the time to upgrade,
then. I honestly thought those commits had been merged into the release
branch.
Okay, so your options now are to not use `for/vector:', use a nightly
build, or build from source. I wouldn't like any of them, but not using
`for/vector:' is probably the least bad.
Again, I apologize.
Neil ⊥