How to implement Data.Map.insertList*?
Mirko Rahn
rahn at ira.uka.de
Wed Feb 23 06:31:42 EST 2005
Ross Paterson wrote:
> import Data.List (foldl')
> addListToFM :: (Ord k) => FiniteMap k a -> [(k,a)] -> FiniteMap k a
> addListToFM m kvs = foldl' add m kvs
> where add m' (k,v) = insert k v m'
Okay, using the strict foldl' the situation changes: Now
insertList_foldl is faster for n>m and slower for n<m. Since n>m in most
cases, I decide to take this version.
Thanks a lot,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
More information about the Libraries
mailing list