[racket] Case with strings: normal behavior?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Nov 19 08:13:09 EST 2012

This is not-quite-intuitive behavior. The `case' form is based on
`eqv?' instead of `equal?', and the first example works because string
literals are interned, while the result of `string-append' is not.

Should we change `case' to use `equal?' instead of `eqv?'? I can't
think of a good reason to stick with `eqv?'.

At Mon, 19 Nov 2012 14:07:16 +0100, Laurent 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

Posted on the users mailing list.