From: Nicolas C. <war...@fr...> - 2004-08-20 19:27:59
|
> >> Do you want me to slap together an OrdHashtbl module? Or do you want to > >> finish it off yourself based on the work you posted to the beginners list > >> earlier today? > > > > IMHO, the ordered hashtable idea is too specialized for inclusion in the > > standard library. Generally, depending upon what order internally a > > hashtable stores it's entries is a bad idea. > > Why is it a bad idea? > > I need to create a Hashtbl based on a file. I'd like to be able to write > the file back out to disk in the same order I read it in. What's wrong > with that? I'm sure there are other applications as well. What you need then is not an ordered Hashtbl since your keys will not keep your file ordered. If I were you I would store the pair (keys,values) in an DynArray and build an Hashtbl so I can retreive the index of the value in the array using only the key. Only a list or an array can keep correctly the order you want. Nicolas |