[racket] Type for transposition idiom
I got this to typecheck:
#lang typed/racket
(: my-list : (All (A B ...) (A B ... B -> (List A B ... B))))
(define (my-list a . bs) (cons a bs))
(: transpose-vector-list (All (A B ...) (-> (List (Vectorof A) (Vectorof B) ... B)
(Vectorof (List A B ... B)))))
(define (transpose-vector-list xss)
(apply vector-map (inst my-list A B ... B) xss))
On Dec 22, 2014, at 9:38 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> Is it possible to get something like this to typecheck in Typed Racket?
>
>
> #lang typed/racket
>
> (: transpose-vector-list (All (A ...) (-> (List (Vectorof A) ... A)
> (Vectorof (List A ... A)))))
> (define (transpose-vector-list xss)
> (apply vector-map list xss))
>
>
> TBH, I haven't even gotten the non-dots version of this working, but the above type is what I really need.
>
> Neil ⊥
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141223/aa532a60/attachment.html>