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

From: Marco Morazan (morazanm at gmail.com)
Date: Mon Oct 6 12:28:21 EDT 2008

On Sun, Oct 5, 2008 at 2:57 PM, Sam TH <samth at ccs.neu.edu> wrote:
> On Sun, Oct 5, 2008 at 1:40 PM, Woodhouse Gregory
> <gregory.woodhouse at gmail.com> wrote:
>>
>> I almost always perform tests with eq? or equal?, seldom (if ever) with eqv?
>> . The Reference is a bit mysterious, saying (in section 3.1)
>>
>> Two values are eqv? if and only if they are eq?, unless otherwise specified
>> for a particular datatype.
>>

The question now is how does the average programmer determine what the
expected behavior is for a particular datatype. Clearly, eqv? and eq?
are not the same:

> (eq? 10000000000 10000000000)
false
> (eqv? 10000000000 10000000000)
true

My real question is why is there a difference for datatypes that are
not mutable? AFAIK, for example, I can not dissect a bignum and make
assignments to individual bigits. Would it not make more sense for eq?
on two numbers to turn into a call to = ?

> (= 10000000000 10000000000)
true

-- 

Cheers,

Marco


Posted on the users mailing list.