Why are Hashes so unsorted? what's your solution?


(David Naseby) #1

From: Gavin Sinclair [mailto:gsinclair@soyabean.com.au]

[good comments snipped]

The term “hash” is so much more fun and elegant than “associative
array.” Let’s come up with a term that is both elegant and accurate
for an ordered entity with a hash-like interface.

When I was at uni, we were taught that the interface was “dictionary”
(maps keys to values) and the common implementations are hash, tree,

There’s only so much you can reasonably dissociate interface from
implementation here, though: hashes are unordered; binary trees have
three orders to choose from! And of course people care about
performance and choose different implementations for different data
sets and use cases.

Since I was the one that made the original gaffe that caused the
Lothar-tirade that led to this, I feel I should weigh in again. I used
"ordered hash" to speak in the language of the OP, and like Hal, I was
pretty much just describing the interface rather than the implementation. To
kill much further talk on the topic, theres a good book review on Slashdot
(http://slashdot.org/article.pl?sid=04/02/19/2257203) of a good data
structure book (Osakasi’s Purely Functional Data Structures).

David Naseby

···

On Thursday, March 4, 2004, 10:07:15 AM, Hal wrote: