University of Washington • CSE583 • D. Notkin
©
2000
23
Equality
l
There are (more
than) two different
notions of equality
in Scheme (and
most other
programming
languages)
–
Are the two entities
isomorphic?
(equal?)
–
Are they the exact
same entity?
(eqv?)
l
(eqv? 3 3)
®
#t
l
(eqv? ’(3 4) ‘(3 4))
®
#f
l
(let ((x ‘(3 4)))
(eqv? x x)
®
#t
l
(equal? ’(3 4) ‘(3 4))
®
#t
l
(eqv? “hi” “hi”)
®
#f
l
(equal? “hi” “hi”)
®
#t
l
(eqv? ‘hi ‘hi)
®
#t
l
(eqv? () ())
®
#t
l