A fact is that equal? does not distinguish between for example two mutable
lists that happen to have the same content (whatever the "same" may mean)
They may be equal? at one moment and not be equal? a little bit later. With
eq? you don't have this problem, BUT that's a very distinct kind of
equality.

Jos

-----Original Message-----
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com]
On Behalf Of Greg Hendershott
Sent: lunes, 18 de mayo de 2015 20:56
To: racket-users@googlegroups.com
Subject: Re: [racket-users] Strange behaviour of the eq? operator in racket
repl

In my early time learning Racket, I wish someone had given me the
following advice:

"""
For now? Just use `equal?`.

`equal?` will usually do the right thing, including for numbers,
strings, symbols, immutable lists, and so on. A type-specific function
like `=` or `string-=?` might be a bit faster. `eq?` might be a lot
faster. But `equal?` will still be correct.

`eq?` or `eqv?` might matter semantically if you're doing certain
things -- but you're not likely to be doing them in your early days
with Racket. So if you're getting side-tracked and confused, you can
probably set it aside for now, and just use `equal?`
"""

That advice might make some of you cringe as simplistic, but it would
have been a helpful simplification for me. And I'm talking about
modern Racket, not Schemes generally.

Of course there are also things like `egal?` that are fun to learn
about, eventually.

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to