# [plt-scheme] eqv? equal?

 From: Jos Koot (jos.koot at telefonica.net) Date: Sun Mar 1 16:08:50 EST 2009 Previous message: [plt-scheme] eqv? equal? Next message: [plt-scheme] Startup window Messages sorted by: [date] [thread] [subject] [author]

```You may also consider:

(define a (box 1))
(define b (box 1))
(eqv? a b) ;--> #f because a and b are two different boxes (see below)
(equal? a b) ;--> #t because boxes a and b have the same content.
(set-box! b 2) ; this does not affect box a!
(equal? a b) ;--> #f because now the boxes have different contents.

There are different meanings for the words "the same". Two of them are:

1: The same content (recursively without being trapped by circular constructs) This is what equal? does (approximately) Because equal? must recur on the structure of the object, it is slower than eqv?.

2: The same in the sense that if the objects are mutable, changing one also changes the other. This is what eqv? does. This means that for objects like boxes, (mutable) lists and vectors, eqv? only has to look whether or not the two arguments point to the same place in storage.

When comparing things like numbers and symbols, equal? and eqv? yield the same results and you probably wont notice any difference in speed.

Jos

----- Original Message -----
From: emre berat nebioglu
To: plt-scheme at list.cs.brown.edu
Sent: Sunday, March 01, 2009 8:15 PM
Subject: [plt-scheme] eqv? equal?

Sorry for this newbie question.But i wonder so much about eqv? and equal?.In the some discussin that passes on ffreenode #scheme.I see some sentence which is "eqv? is faster than equal? in comparison.So i thought eqv? and equal? returns boolean thing #t or #f right ? So why?

In that point,i have three question about that.

what is the thing that makes eqv? faster than equal?.

which one is more powerful on programming  ?

What is the reason that equal? still be used ? If eqv? is faster than equal?.

Regards.

------------------------------------------------------------------------------

_________________________________________________