[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new wording for eqv?



Eliminate the second and third paragraphs of section 6.2, and
eliminate the seven bullet items that follow them.

Change the description of eqv? as follows.



(eqv? obj1 obj2)                          essential procedure

The eqv? procedure defines a useful equivalence relation on
objects.  Briefly, it returns #t if obj1 and obj2 should normally
be regarded as the same object and returns #f if they should
normally be regarded as distinct objects.  This relation is left
slightly open to interpretation, but the following partial
specification of eqv? holds for all implementations of Scheme.

The eqv? procedure returns #t if:

obj1 and obj2 are both #t or both #f.

obj1 and obj2 are both symbols and both print the same
way (provided neither obj1 nor obj2 is an ``uninterned
symbol'' as alluded to in section 6.4).

obj1 and obj2 are both numbers, are numerically equal
(see =, section 6.5.4), and are either both exact or
both inexact (see section 6.5.2).

obj1 and obj2 are both characters and are the same
character according to the char=? procedure (section
6.6).

both obj1 and obj2 are the empty list.

obj1 and obj2 are pairs created at the same time by
the same call to cons, so that a set-car! operation
on obj1 will change the contents of the car field of
obj2 and vice versa, and similarly for set-cdr!.

obj1 and obj2 are vectors created at the same time by
the same call to make-vector, so that a vector-set!
operation on obj1 will change the contents of the
corresponding element of obj2 and vice versa.

obj1 and obj2 are strings created at the same time by
the same call to make-string, so that a string-set!
operation on obj1 will change the character stored at
the corresponding position of obj2 and vice versa.

obj1 and obj2 are procedures created at the same time
from the same lambda expression, so that they behave
identically.


The eqv? procedure returns #f if:

one of obj1 and obj2 is a boolean but the other is not.

one of obj1 and obj2 is a symbol but the other is not.

one of obj1 and obj2 is a number but the other is not.

one of obj1 and obj2 is a pair but the other is not.

one of obj1 and obj2 is a vector but the other is not.

one of obj1 and obj2 is a string but the other is not.

one of obj1 and obj2 is a procedure but the other is not.

one of obj1 and obj2 is #t but the other is #f.

obj1 and obj2 are symbols that do not print the same way.

one of obj1 and obj2 is an exact number and the other is an
inexact number.

obj1 and obj2 are numbers for which the = procedure returns
#f.

obj1 and obj2 are characters for which the char=? procedure
returns #f.

one of obj1 and obj2 is the empty list but the other is not.

obj1 and obj2 are pairs created at different times by
distinct calls to cons.

obj1 and obj2 are vectors created at different times by
distinct calls to make-vector, and at least one of them
has vector-length greater than zero.

obj1 and obj2 are strings created at different times by
distinct calls to make-string, and at least one of them
has string-length greater than zero.

obj1 and obj2 are procedures that would behave differently
(return a different value or have different side effects)
for some arguments.

[The first block of examples goes here, omitting the
(eq? "" "") example, which should be added to the second
block of examples.]

The following examples illustrate cases in which the above
rules do not fully specify the behavior of eqv?.  In every
case, the value returned by eqv? is either #t or #f, but
which one it returns is implementation-dependent.

[The second block of examples goes here, following by the
paragraph beginning "The next set of examples shows...",
followed by the gen-counter and gen-loser examples.]

Objects of distinct types must never be regarded as the same
object, except that #f and the empty list are permitted
to be identical, and the character type need not be disjoint
from other types.

[The fourth block of examples goes here, followed by the
paragraph beginning "Since it is an error...", followed by
the fifth block of examples, followed by the note.]