object equality
can we test whether vars are aliases?
- if x and y name cons cells
(eq? x y) ==> #t when they denote the same one
(equal? x y) ==> #t when their values would print out in the same way
- object equality versus value equality
example
- after
(define x (cons 1 2))
(define y (cons 1 2))
(define z y)
- x and y are value equal, but x and z are object equal
(eq? x y) ==> #f
(equal? x y) ==> #t
(eq? x z) ==> #t
(equal? x z) ==> #t
- so a change to x will appear to be achange to z but not y
(set-car! x 3)
(car y) ==> 1
(car z) ==> 3