
30 Jan
2008
30 Jan
'08
9:18 a.m.
Duncan Coutts
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