On Saturday 03 August 2002 17:45, you wrote: > ----- Original Message ----- > ... > > Yes, but that's my point: It's not a hash any more. It's > like an array of single-element hashes. > > To find the value associated with key 'a', I'd have to > *know* that 'a' was in ordhash[0]. > > Someone yesterday (?) posted an interesting use of > Array#assoc... I think this is probably the "right" way to > implement an ordered hash... and I wish I had thought of > that two years ago. >... > > Hal Generally the right way to implement an ordered "hash" is with a tree. Sometimes, depending on why you need it to be ordered, an ordinary hash, where he members are lists is a better choice. I suppose the questions that determine this are: 1) Why are you specifying a hash? Is it just for the random access capability, or is there some other reason (e.g., the ability to extract an access code). 2) Do you need the access key to be sorted, or are you maintaining a list of entities with the same access key? 3) How big is this thing, anyway? Are you planning to store it on disk, and only roll in the needed parts, or is it RAM resident? (This can make a tree the right answer no matter how the other questions are answered.) Under the normal interpretations, an "ordered hash" is a contradiction in terms, so I'm guessing that you probably have some other meaning, like one that keeps an ordered list of members with the same key value.