Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eq? & eqv? qustion

1 view
Skip to first unread message

Question

unread,
Oct 3, 2004, 5:28:34 AM10/3/04
to
I have read "Revised report on the Algorithmic language Scheme", but I
am still confused about the difference between eq? and eqv? . the only
thing I knew was that eq? is the finest discriminating, and equal? is
the coarsest, eqv? is in between. But this statement doesn't provide me
"WHAT" the distinctions are.

Please provide me some cases that for the same argument, eq? and eqv?
evaluates differently.

thank you.

Prof. R. Fateman

unread,
Oct 3, 2004, 10:48:08 AM10/3/04
to


(define a (list 1 2))

(define b (list 1 2))

(eq? a b)
(eqv? a b)
(eq? a a)

It's like this. If you were on the beach and you saw a
Great White Shark X in the water, and a hour later someone
else saw a Great White Shark Y in the water, and then
two hours later someone killed a Great White Shark Z
in the water, you would very much like to know if

(and (eq? X Y) (eq? Y Z)) ; there was only one shark seen, and it is dead.

versus

(and (eqv? X Y) (eqv? Y Z)) ; there may be one, two, or three sharks, all Great White Sharks.

; one of them is dead.

You mostly use eqv? and equal? in this course.

You can use eq? if you are comparing symbolic atoms, or if you really
care to make a case that THIS '(a b c) and THAT '(a b c) are different
even though their corresponding subparts are eq. or that
if (define whale '(a b c)) .. (eq? whale whale) but not (eq? whale (cons 'a '(b c)))

RJF

Question

unread,
Oct 3, 2004, 10:24:20 PM10/3/04
to
Professor RJF,
thank you, I got it and remembered.

Greg Krimer

unread,
Oct 4, 2004, 2:44:51 AM10/4/04
to
Dear Question,

Unless you're in the witness protection program please use your real name
when posting to this newsgroup.

0 new messages