Created
October 15, 2015 17:33
-
-
Save mzemel/de4647528a35c4264ce4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Math do | |
def times_three(n), do: n * 3 | |
def odd?(n), do: rem(n, 2) != 0 | |
end | |
Enum.sum( | |
Enum.filter( | |
Enum.map(1..100_000, &(Math.times_three/1)), &(Math.odd?/1))) | |
1..100_000 | |
|> Enum.map(&(Math.times_three/1)) | |
|> Enum.filter(&(Math.odd?/1)) | |
|> Enum.sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment