RFR 8009736: Comparator API cleanup (original) (raw)
Per Bothner per at bothner.com
Wed Jun 12 17:23:26 UTC 2013
- Previous message: RFR 8009736: Comparator API cleanup
- Next message: RFR 8009736: Comparator API cleanup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
per at bothner.com http://per.bothner.com/
- Previous message: RFR 8009736: Comparator API cleanup
- Next message: RFR 8009736: Comparator API cleanup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]