
17 Jul
2011
17 Jul
'11
10:09 a.m.
On Jul 17, 2011, at 3:57 AM, Kees Bleijenberg wrote:
2. A fast way to find the key with the lowest map-value (without traversing the whole map).
I see. If you were to implement it without worrying about the performance, you could just use a map and compute a fold over the map to find the min value. To have better performance, you want to incrementally recompute the fold at each update. This is the topic of an article that I wrote for the Monad.Reader called "How to refold a map."
I show how to modify Data.Map for that purpose. Also, it turns out to be really nice to implement it in FingerTrees. If you would like I can post that too. ___________________ David Place Owner, Panpipes Ho! LLC http://panpipesho.com d@vidplace.com