Personal tools

Talk:Key-value apply

From HaskellWiki

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

function on the content page occurs because the case actually transforms the
into a tree to facilitate faster searching. The
module does the exact same thing - but it's already implemented for you! Is a function like
already out there somewhere?
Possibly, if you take the
as the keys in the map implementation. (I haven't had this exact case in my use of
so far) BrettGiles 18:39, 16 February 2007 (UTC)