[racket] clarification for a Typed Racket error?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Jan 7 17:22:24 EST 2012

This is clearly a bug -- the code ought to typecheck just fine.  I'll
take a look at it.

On Fri, Jan 6, 2012 at 2:24 AM, Erik Silkensen <eriksilkensen at gmail.com> wrote:
> Hi,
>
> I was wondering if someone could help me understand the problem with the following code?
>
> (struct: obj ([a : Integer] [b : Symbol]))
>
> (: f1? (obj Symbol -> Boolean))
> (define (f1? o x)
>  (and (= 0 (obj-a o))
>      (eq? x (obj-b o))))
>
> (: f2? (obj Symbol -> Boolean))
> (define (f2? o x)
>  (and (zero? (obj-a o))
>      (eq? x (obj-b o))))
>
> (: f3? (obj Symbol -> Boolean))
> (define (f3? o x)
>  (and (eq? x (obj-b o))
>      (zero? (obj-a o))))
>
> It looks like f1 and f3 are ok, but f2 has the error "Type Checker: Expected obj, but got #(struct:#<syntax:3:9 obj> ((U Inexact-Complex Real-Zero) Symbol)) in: o".
>
> Thanks,
> Erik
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



-- 
sam th
samth at ccs.neu.edu



Posted on the users mailing list.