Last active
March 31, 2017 23:06
-
-
Save slofurno/a185945fcbcd913c77800aa20596a772 to your computer and use it in GitHub Desktop.
This file contains 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 S do | |
def fizzbuzz(n), do: fb(3, 5, 1, n, []) | |
def fb(_fizz, _buzz, i, i, r), do: r |> Enum.reverse | |
def fb(i, i, i, j, r) do | |
fb(i+3, i+5, i+1, j, ["FizzBuzz"|r]) | |
end | |
def fb(i, buzz, i, j, r) do | |
fb(i+3, buzz, i+1, j, ["Fizz"|r]) | |
end | |
def fb(fizz, i, i, j, r) do | |
fb(fizz, i+5, i+1, j, ["Buzz"|r]) | |
end | |
def fb(fizz, buzz, i, j, r) do | |
fb(fizz, buzz, i+1, j, [i|r]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment