[plt-scheme] When does eqv? differ from eq? , from equal?

From: Alan Watson (alan at alan-watson.org)
Date: Mon Oct 6 09:15:20 EDT 2008

>> What is the intuition behind eqv?
>
> Beats me.  I've never used EQV? in my life.

Really? You're never used the "case" syntax? :-)

Think of eqv? as the fundamental identity predicate. If two data  
structures are eqv?, then the only way you can tell them apart is by  
using eq?. And using eq? is cheating because in some circumstances it  
can differ from implementation to implementation.

Think of eq? as being a short-cut for eqv? for certain data structures  
(for example, those that can be side effected) but depending on the  
implementation for others (for example, characters and numbers).

IMHO, if you are using eq? in your programs, you are probably guilty  
of premature optimization.

Regards,

Alan

P.S. If Scheme is defined as "doing the right thing and damning the  
torpedoes", I would assert that eq? should not be part of Scheme.
-- 
Alan Watson
http://www.alan-watson.org/



Posted on the users mailing list.