Duncan Coutts <duncan.coutts <at> worc.ox.ac.uk> writes:
> Data.List.foldr (Data.Set.delete) s [1,3,5]
> or
> Data.List.foldl' (flip Data.Set.delete) s [1,3,5]

There will be a day when I finally grasp foldr/foldl :)
> 
> which is O (n + m * log m) rather than O(m * log n) or if the elements
> you're deleting are already sorted you can shave off the log m using
> Data.Set.fromAscList to get just O (n + m).

Thanks for advice. My data is sorted so the above applies really well.

-- 
Gracjan


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to