[racket] typing a function
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.
Cheers
P.