Skip to content

Instantly share code, notes, and snippets.

@melkir
Created October 8, 2017 00:37
Show Gist options
  • Save melkir/bcde023aa66bed25d5087a9c55a8f9b0 to your computer and use it in GitHub Desktop.
Save melkir/bcde023aa66bed25d5087a9c55a8f9b0 to your computer and use it in GitHub Desktop.
whichfizz = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, n) -> n
end
fizzbuzz = fn(n) ->
whichfizz.(rem(n, 3), rem(n, 5), n)
end
IO.inspect Enum.map(1..100, fizzbuzz)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment