Previous: comparisons minmax, Up: comparisons [Index]
Constructs a compare procedure equivalent to compare but with debugging code wrapped around the calls to compare. The debugging code signals an error if it detects a violation of the axioms of a compare function. For this it is assumed that compare has no side–effects.
More specifically, (debug-compare compare)
evaluates to a
compare procedure compare1 which checks reflexivity, antisymmetry,
and transitivity of compare based on the arguments on which
compare1 is called:
The procedure compare1 checks reflexivity on any value passed to compare, antisymmetry on any pair of values on which compare is called, and transitivity on triples where two of the arguments are from the current call to compare1 and the third is a pseudo–random selection from the two arguments of the previous call to compare1.