RFR 8009736: Comparator API cleanup
per at bothner.com
Wed Jun 12 10:23:26 PDT 2013
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.
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 at bothner.com http://per.bothner.com/
More information about the lambda-dev