Skip to content

Instantly share code, notes, and snippets.

@rekyuu
Created November 18, 2015 03:08
Show Gist options
  • Select an option

  • Save rekyuu/c6b721c9d9c803ed7270 to your computer and use it in GitHub Desktop.

Select an option

Save rekyuu/c6b721c9d9c803ed7270 to your computer and use it in GitHub Desktop.
Elixir fizzbuzz
fizzword = fn
(0, 0, _) -> "fizzbuzz"
(0, _, _) -> "fizz"
(_, 0, _) -> "buzz"
(_, _, n) -> n
end
fizzbuzz = fn (n) ->
fizzword.(rem(n, 3), rem(n, 5), n)
end
IO.inspect Enum.map(1..50, fizzbuzz)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment