DEV Community

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

Collapse
 
aminnairi profile image
Amin

Elm

I really wish flip is part of the core library...

flip : (a -> b -> c) -> (b -> a -> c)
flip f a b = f b a

squareSum : List Int -> Int
squareSum integers =
    List.foldl (flip (^) 2 >> (+)) 0 integers