Common Lisp Package: MW-EQUIV

README:

FUNCTION

Public

OBJECT-SEQUENCE= (XS YS)

Checks whether sequences XS and YS are element-wise equivalent, by means of OBJECT=, and of the same length.

OBJECT-VECTOR= (XS YS)

Checks whether vectors XS and YS are element-wise equivalent, by means of OBJECT=, and of the same length. Use OBJECT-SEQUENCE= instead.

OBJECT= (X Y &OPTIONAL FROZENP)

Returns true if X and Y are (observationally) equivalent. Hence, OBJECT= is an equivalence relation: 1. (object= x x) 2. (equal (object= x y frozenp) (object= y x frozenp)) 3. (implies (and (object= x y frozenp) (object= y z frozenp)) (object= x z frozenp)) Frozen objects (i.e., objects which are promised not to mutate) are compared by recursing into their constituents, as specified by OBJECT-CONSTITUENTS. Mutable (i.e., not frozen) objects are compared with the pointer equality EQ. FROZENP can be used to override the defaults for X and Y given by OBJECT-FROZENP. It is a promise that none of the objects X and Y are referring to with their constituents, or **any of the constituents' constituents** are mutated from the time of the call to OBJECT= onwards. If one lies with FROZENP, OBJECT-FROZENP, or OBJECT-CONSTITUENTS, all bets are off and the result of OBJECT= is meaningless. OBJECT= diverges if both X and Y are circular data structures. See also: <http://home.pipeline.com/~hbaker1/ObjectIdentity.html>

GENERIC-FUNCTION

Public

OBJECT-CONSTITUENTS (TYPE)

Returns list of accessors used to determine equivalence of objects of type TYPE.

OBJECT-FROZENP (OBJECT)

Indicates whether OBJECT is frozen. That is, this function may return true only if OBJECT will not be mutated in an observable way from the point of the call until the end of its life time, otherwise false.