Skip to content

Instantly share code, notes, and snippets.

@mzemel
Created October 15, 2015 17:33
Show Gist options
  • Save mzemel/de4647528a35c4264ce4 to your computer and use it in GitHub Desktop.
Save mzemel/de4647528a35c4264ce4 to your computer and use it in GitHub Desktop.
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