Skip to content

Instantly share code, notes, and snippets.

@rrshaban
Last active January 12, 2016 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrshaban/050a9336d5989c592249 to your computer and use it in GitHub Desktop.
Save rrshaban/050a9336d5989c592249 to your computer and use it in GitHub Desktop.
FizzBuzz in Elixir
fb_helper = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, x) -> x
end
fizz_buzz = fn
n -> fb_helper.(rem(n, 3), rem(n, 5), n)
end
IO.inspect Enum.map(1..100, fizz_buzz)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment