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

From: Sam TH (samth at ccs.neu.edu)
Date: Sun Oct 5 14:57:10 EDT 2008

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.
>
> That doesn't help much. Well, it does help, but only by telling me that they
> are usually the same. Heuristically, I think of eq? as being similar to
> comparing pointers in C and equal? as a test that might involve library call
> that could run in time proportional to the size of the objects (e.g.,
> strcmp). What is the intuition behind eqv?

`eqv?' is intended to mean 'the same thing', without reference to the
implementation, whereas `eq?' means 'refers to the same thing in the
heap.  In particular, two numbers (or strings or characters) may be
eqv? without being eq?.


-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.