DEV Community

Discussion on: Daily Coding Puzzles - Nov 11th - Nov 16th

Collapse
 
sdicke profile image
Sebastian Martin Dicke • Edited

Another Haskell solution:

dont_give_me_five :: [Int] -> Int
dont_give_me_five = foldl (\x y -> if notElem '5' $ show y then x + y else x) 0

Or a little bit shorter in the same language:

dont_give_me_five :: [Int] -> Int
dont_give_me_five = foldl1 (\x y -> if notElem '5' $ show y then x + y else x)