[plt-scheme] BUG in case

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Jun 25 20:33:46 EDT 2003

At Thu, 26 Jun 2003 03:22:05 +0000, "Saint Katsmall T. Wise, Esquire" wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> This bug has been driving me crazy all day and I just found out it's not 
> a bug in my code :\
> I have two variables: green-char and c. They are both set to #\012, 
> which incidentally is a newline.
> Thus, they are eqv? indeed as the example shows.
> However, case does not recognize them to be the same (although it is 
> supposed to use eqv?)
> 
>  > (eqv? green-char c)
> #t
>  > (case c [(green-char) 'a] [else 'b])
> b
> 
> Is this indeed a bug?

No -- case implicitly quotes its argument; you probably want either
this:

  (cond 
    [(eqv? c green-char) 'a]
    [else 'b])

or

  (case c [(#\012) 'a] [else 'b])

Robby

PS: congrats on your sainthood.


Posted on the users mailing list.