The equal? procedure defines an equivalence relation on objects.
It returns #t if obj1 and obj2
should be regarded as the same object, and otherwise returns
#f. For objects that have external representations, two
objects shall be the same if their external representations are the
same.
If each of obj1 and obj2 is of type boolean,
symbol, char, pair, quantity, or string, then the equal?
procedure shall return #t if and only if:
| • obj1 and obj2 are both #t or both #f. |
| • obj1 and obj2 are both symbols and
|
| (string=? (symbol->string obj1)
(symbol->string obj2))
#t |
| • obj1 and obj2 are both numbers, are numerically
equal in the sense of =, and are either both exact or both inexact. |
| • obj1 and obj2 are both strings and are the same
string according to the string=? procedure. |
| • obj1 and obj2 are both characters and are the same
character according to the char=? procedure. |
| • obj1 and obj2 are both the empty list. |
| • obj1 and obj2 are both pairs
and the car of obj1 is equal? to the car
of obj2
and the cdr of obj1 is equal? to the cdr
of obj2. |
If one of obj1 and obj2 is a procedure and the
other is not, then equal? shall return #f. If
obj1 and obj2 are both procedures then
equal? shall return #f if obj1 and
obj2 would return a different value for some arguments, and
otherwise shall return either #t or #f.
| In other words equality for procedures is not well defined. |
|