DEV Community

loading...

Discussion on: Daily Challenge #225 - Square'n'Sum

Collapse
citizen428 profile image
Michael Kohl • Edited

How about this?

squareSum :: [Int] -> Int
squareSum = sum . fmap (^2)

Also point free and a bit easier on the eye. If we want to keep it single traversal, maybe

squareSum = foldr ((+) . (^2)) 0