> On Dec 11, 2015, at 5:27 PM, David Storrs <[email protected]> wrote:
> 
> 
> 
> On Fri, Dec 11, 2015 at 1:53 PM, Matthew Butterick <[email protected] 
> <mailto:[email protected]>> wrote:
> PS. I'm assuming that you're using `eq?` here in deliberate preference to 
> `equal?`. Because `eq?` is not reliable for string comparisons.
> 
> Ah.  No, I did not realize that.  I thought that Racket worked on a flyweight 
> pattern where all strings of the same characters were eq?  -- isn't that what 
> interned symbols are about?

Some examples:

> (eq? "foo" "foo")
#t
> (eq? "foo" (symbol->string 'foo))
#f
> (eq? (symbol->string 'foo) (symbol->string 'foo))
#f
> (eq? "foo" (datum-intern-literal (symbol->string 'foo)))
#t

So, string constants produced by the reader seem to be eq?, but strings 
produced by any other operation, such as symbol->string, string-append, format, 
etc, will not be.


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to