[racket] Case with strings: normal behavior?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Nov 19 08:19:13 EST 2012

I can't think of a good reason either.

We could do a trial period where it uses eqv? and equal? and complains
if it finds a difference and then ask people to run programs. That
seems like an easy enough experiment.

Robby

On Mon, Nov 19, 2012 at 7:13 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.