3 ms·
since a map and a sum are both folds, you can simplify it further: f = foldr (\x total -> total + (x * x)) 0 but this is actually a counter argument. look at
by pasquinelli 9y ago
since a map and a sum are both folds, you can simplify it further:
f = foldr (\x total -> total + (x * x)) 0
but this is actually a counter argument. look at all these ways of doing this simple operation with higher order functions. plenty of replies from intellectual napoleons like me, too. whereas with the for loop, there's nothing much to say, which seems like a good thing.
i genuinely don't know how to feel about this.