Re: [Haskell] combining IntMaps

2005-07-30 Thread Adrian Hey
On Saturday 30 Jul 2005 7:07 pm, Daan Leijen wrote: > Efficiency wise, I think one should only provide functions that ensure that > the complexity does not get worse -- if one also considers functionality > that improves on a constant factor (like traversing twice) there is no end > to the number o

Re: [Haskell] combining IntMaps

2005-07-30 Thread Daan Leijen
Adrian Hey wrote: Hello, Thanks! It's interesting the way your AVL tree library is set up -- there seems to be a much broader degree of functionality than that provided by Data.Set. But I'm trying to see, is there a significant difference in the fundamental data structure. Well Data.Set is ba

Re: [Haskell] combining IntMaps

2005-07-30 Thread Daan Leijen
Hi Chad, Scherrer, Chad wrote: the sum of the values is zero. My specification is addMaps :: IntMap Int -> IntMap Int -> IntMap Int addMaps m = IntMap.filter (/= 0) . IntMap.unionWith (+) m But I'm not really happy with this because it traverses both maps for the union, and then traverses the