[racket] 3D Plot example doesn't work in Typed Racket

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri May 30 10:17:55 EDT 2014

p.s. I happened to paste the error message from 5.3.5. The TR error
message format in recent versions of Racket is much nicer; kudos!

; /tmp/tr.rkt:4:8: Type Checker: type mismatch
;   expected: (Sequenceof
;              (U (Vector Any Any (U Real False ivl))
;                 (List Any Any (U Real False ivl))))
;   given: (List
;           (Vector Symbol Symbol Integer)
;           (Vector Symbol Symbol Integer)
;           (Vector Symbol Symbol Integer))
;   in: (discrete-histogram3d (quote (#(a a 1) #(a b 2) #(b b 3)))
#:label "Missing (b,a)" #:color 4 #:line-color 4)


On Fri, May 30, 2014 at 10:13 AM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> This example from the plot docs works great:
>
>     #lang racket
>     (require plot)
>     (plot-new-window? #t)
>     (plot3d (discrete-histogram3d '(#(a a 1) #(a b 2) #(b b 3))
>                                     #:label "Missing (b,a)"
>                                     #:color 4 #:line-color 4))
>
> But not with Typed Racket:
>
>     #lang typed/racket   ;<- typed
>     (require plot/typed) ;<- typed
>     (plot-new-window? #t)
>     (plot3d (discrete-histogram3d '(#(a a 1) #(a b 2) #(b b 3))
>                                     #:label "Missing (b,a)"
>                                     #:color 4 #:line-color 4))
>     ; /tmp/tr.rkt:7:8: Type Checker: Expected (Sequenceof (U (Vector
> Any Any (U Real False ivl)) (List Any Any (U Real False ivl)))), but
> got (List (Vector Symbol Symbol Integer) (Vector Symbol Symbol
> Integer) (Vector Symbol Symbol Integer))
>     ;   in: (discrete-histogram3d (quote (#(a a 1) #(a b 2) #(b b 3)))
> #:label "Missing (b,a)" #:color 4 #:line-color 4)
>
> It fails to typecheck on 6.0.1.10, but also back on 5.3.5.
>
> I don't understand the error; a list is a sequence, no?

Posted on the users mailing list.