You might find interesting this proposal for "big" Scheme.
It views a "comparator" as a bundle consisting of an (optional)
comparator function, along with optional hash function,
equality function, and type-check function.

http://trac.sacrideo.us/wg/wiki/ComparatorsCowan

Using a more general "comparator bundle" can be
convenient at times.  For example when constructing
a hash table it is useful to pass the equality
function and the hash function as single object.
(Of course you normally don't use the compare
functions in those cases.)

If the ComparatorsCowan becomes part of Scheme,
I'd probably implement it as a class that implements
java.util.Comparator, at least for bundles that
have an actual compare function.
--
        --Per Bothner
p...@bothner.com   http://per.bothner.com/

Reply via email to