fjames86 / mhash

Multiple key hash tables
2 stars 0 forks source link

Difference from using e.g. lists as keys? #1

Open xach opened 11 years ago

xach commented 11 years ago

This seems like a neat idea, but I think if I wanted multiple keys I'd just create a key from a list of keys. What advantages does mhash offer?

Thanks.

fjames86 commented 11 years ago

Yeah you could just use a standard hash table with a list of keys and the test #'equal, that gives the same functionality. I wrote this little library partly as a learning exercise, although it's not quite finished yet.

My aim is to add multi-dimensional triangular arrays, which index elements on combinations of subscripts rather than permutations. With this, I'd be able to access elements in the hash table without some ad hoc definition of sorting. If we were using standard hash tables with lists of keys, we'd not be able to know that (gethash (list 'a 'b 12) ht) is equivalent to (gethash '(12 a b) ht) without first sorting this list with some pre-defined, and case-specific, sorting function. I have a reason for wanting this type of hash table.

Thanks for your interest, and of course quicklisp!

Frank.