# Talk:Key-value apply

### From HaskellWiki

Revision as of 18:39, 16 February 2007 by BrettGiles (Talk | contribs)

## Initial problem context

This function actually occurred in the definition of a larger utility. It has the type

decode :: (Eq k) => [([k],[v])] -> [k] -> [v]

This takes a large input, searches the lookup table for the longest possible matching key, and returns the corresponding value. It then processes the rest of the input the same way.

Theapply

[([k],[v])]

*tree*to facilitate faster searching. The

Data.Map

decode

- Possibly, if you take the as the keys in the map implementation. (I haven't had this exact case in my use of[k]so far) BrettGiles 18:39, 16 February 2007 (UTC)Data.Map