[racket] Case with strings: normal behavior?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Nov 19 08:12:50 EST 2012

`case` compares values with `eqv?`, which distinguishes
distinctly-allocated strings with the same contents.  Using `match`
instead of `case` will fix the problem.

On Mon, Nov 19, 2012 at 8:07 AM, Laurent <laurent.orseau at gmail.com> wrote:
> Hi,
>
> Is this a bug or a not quite intuitive normal behavior?
>> (define (foo s)
>     (case s
>       [("a") 'a]
>       [else 'none]))
>> (foo "a")
> 'a
>> (foo (string-append "a" ""))
> 'none
>
> in 5.3.1.5--2012-11-08(5589bcb/a) [3m].
>
> Laurent
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>



-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.