Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Multi-keyed lookup table?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-08-07 (22:26)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] Multi-keyed lookup table?
Yaron Minsky wrote:

> This might be too simplistic, but how about creating a union type the
> includes all of the different things you might want to index on, and then
> use that as the key to a hashtable.  The efficiency of that would hinge on
> the efficiency of the hash function, I would think.   I would expect it to
> be simple to implement and pretty quick.

That's actually a fairly neat trick to embody multiple
index tables in one data structure. The main problem is probably
that hashtables aren't ordered, so there is no way of getting
all the values of a particular 'index' quickly. A Map does not
have this problem .. but then it doesn't hash ..

where's that cake I've just eaten ..

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: