[plt-scheme] String equality and other questions

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Sep 25 01:21:30 EDT 2008

Thanks for sending me some code.

Your program imports SRFI 63, which apparently provides its own
`equal?' that is shadowing the usual one. (I noticed this by clicking
Check Syntax in DrScheme and then mousing over the `equal?' identifier
in your program.)

The `equal?' in the SRFI 63 implementation, meanwhile, seems to have
been completely broken. I committed a repair to SVN.


At Wed, 24 Sep 2008 06:02:49 -0700, Matthew Flatt wrote:
> At Tue, 23 Sep 2008 21:25:26 -0700 (PDT), Deep wrote:
> > While writing a game in scheme I recently ran into an issue where
> > using equal? to compare strings would wait on the equality test and
> > hog the cpu 60-70% of the time.  Oddly enough it worked sometimes. I
> > looked through my code suspecting a recursive call gone amuck but
> > eventually narrowed the issue down to this call.  I had unfortunately
> > run into http://www.federated.com/~jim/schintro-v14/schintro_102.html
> > when searching for "scheme string equality" and used equal?.
> > 
> > Once I looked again and changed the code to use string=? things work
> > just fine. I wanted to know what does equal? do when used against
> > strings. Why does it work sometimes and why does it just hang on other
> > occasions?
> As Eli says, that's a surprising result. The `equal?' function is
> commonly used on strings, and assuming that you're using a language
> like `scheme/base', R5RS, or R6RS (all the same `equal?'), then
> `equal?' fairly quickly determines when it's given strings and then
> does the same thing as `string=?'.
> If your program is something that you can send to me, then I'm
> interested to try it myself (with `equal?' in place of `string=?').
> Matthew
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.