[Haskell-cafe] Pure hashtable library

Thomas Davie tom.davie at gmail.com
Wed Aug 27 04:15:43 EDT 2008


On 27 Aug 2008, at 10:09, Bulat Ziganshin wrote:

> Hello Jason,
>
> Wednesday, August 27, 2008, 11:55:31 AM, you wrote:
>
> >> given these constraints, it should be just a 10-20 lines of
> >> code, and provide much better efficiency than any tree/trie
> >> implementations
>
> >   Much better efficiency in what way?
>
> instead of going through many levels of tree/trie, lookup function  
> will just select array element by hash value and look through a few  
> elements in assoc list:
>
> data HT a b = HT (a->Int)               -- hash function
>                  (Array Int [(a,b)])
>
> HT.lookup (HT hash arr) a   =   List.lookup (arr!hash a) a
Which makes two assumptions.  One is that your array is big enough  
(believable), and the other, that your font is big enough.

Bob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080827/7106550e/attachment-0001.htm


More information about the Haskell-Cafe mailing list