Buy GNU books!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Three different kinds of sameness are defined in Scheme.
The differentiation between these three kinds is important, because determining whether two values are the same objects is very efficient, while determining structural equivalence can be quite expensive (consider comparing two very long lists). Therefore, three different procedures for testing for equality are provided, which correspond to the three kinds of sameness defined above.
#tiff x references the same object as y.
eq?is similar to
eqv?except that in some cases it is capable of discerning distinctions finer than those detectable by
eqv?procedure defines a useful equivalence relation on objects. Briefly, it returns
#tif x and y should normally be regarded as the same object. This relation is left slightly open to interpretation, but works for comparing immediate integers, characters, and inexact numbers.
#tiff x and y are recursively
equal?recursively compares the contents of pairs, vectors, and strings, applying
eqv?on other objects such as numbers and symbols. A rule of thumb is that objects are generally
equal?if they print the same.
equal?may fail to terminate if its arguments are circular data structures.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|