[Haskell-cafe] Deleting list of elements from Data.Set

Gracjan Polak gracjanpolak at gmail.com
Wed Jan 30 06:05:19 EST 2008



My strictness analyser in my brain hurts. Which one (foldl,foldl',foldr) is the
best way?

Prelude Data.Set Data.List> let s = fromList [1,2,3,4,5]
Loading package array-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.0 ... linking ... done.

Prelude Data.Set Data.List> foldl (.) id 
            (Data.List.map Data.Set.delete [1,3,5]) s
fromList [2,4]

Prelude Data.Set Data.List> foldl' (.) id 
            (Data.List.map Data.Set.delete [1,3,5]) s
fromList [2,4]

Prelude Data.Set Data.List> foldr (.) id 
            (Data.List.map Data.Set.delete [1,3,5]) s
fromList [2,4]

Which one is best?

-- 
Gracjan




More information about the Haskell-Cafe mailing list