[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Seeking review of sets and hash tables proposals
On 05/24/2013 10:30 PM, John Cowan wrote:
> Per Bothner scripsit:
>
>> Note also some hash tables are sorted. For example:
>> http://docs.oracle.com/javase/7/docs/api/java/util/SortedMap.html
>
> That's an interface, and the classes that implement it are a tree map
> and a skip-list map, not a hash map. AFAIK there is no way to be both
> ordered and have O(1) behavior.
You're right, of course.
A 'comparator' data type might be still be worth considering.
I could work well with a small library of utility routines.
For example (ascending PROJ) and (descending PROJ) take a one-argument
"projection" function that is applied to the elements to be
compared. Another useful utility (useful for sorting)
takes a list of comparators, where the first element is
the primary key, the second the secondary key, etc.
Anyway, this is all very hand-wavy ...
--
--Per Bothner
per@x http://per.bothner.com/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports