her.esy.fun/src/posts/0010-Haskell-Now/evenSum_v7.hs

6 lines
180 B
Haskell
Raw Normal View History

2019-12-25 15:35:56 +00:00
-- Version 7
-- Generally it is considered a good practice
-- to import only the necessary function(s)
import Data.List (foldl')
evenSum l = foldl' (\x y -> x+y) 0 (filter even l)