Trie implementation

Tomasz Zielonka tomasz.zielonka at gmail.com
Fri Feb 11 06:50:35 EST 2005


On Fri, Feb 11, 2005 at 11:28:11AM +0000, Keith Wansbrough wrote:
> Hi... I was writing some code yesterday to walk over a directory tree, 
> and needed a Trie.  Not seeing one around, I wrote a basic 
> implementation of the functions I needed (attached below).
> 
> Has anyone else done this?  Should I polish it up and offer it for 
> inclusion in Data?

Yes, definitely! I have implemented Trie's in Haskell about three times,
each time with a slightly different interface :)

Your module looks very nice. It has many natural functions I haven't
thought about.

Could you also include a function:

    insert :: Ord k => [k] -> (Maybe v -> v) -> Trie k v -> Trie k v
or
    insert :: Ord k => [k] -> (Maybe v -> Maybe v) -> Trie k v -> Trie k v

Best regards,
Tomasz

-- 
Szukamy programisty C++ i Haskell'a: http://tinyurl.com/5mw4e


More information about the Libraries mailing list