3 ms·
Looks nice in Haskell too. product (map (\n -> n ^ n) [1..5]) == 1000 * 60 * 60 * 24 => True
by 18nleung 9y ago
Looks nice in Haskell too.
product (map (\n -> n ^ n) [1..5]) == 1000 * 60 * 60 * 24
=> True
- oerpli 9y agoI recommend looking at . and $ to make code more readable (by preventing unnecessary brackets) product $ map (\x -> x^x) [1..5] (.) :: (b -> c) -> (a -> b) -> a -> c ($) :: (a -> b) -> a -> b => f (g (h x)) == f . g . h $ 5