Skip to content

Commit

Permalink
TF?
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmebirdie committed Dec 7, 2020
1 parent d3bfb00 commit 5429c89
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -114,62 +114,3 @@ enddefmodule Roman do
roman <> numerals(number - arabic)
end.()
end
enddefmodule Roman do
@roman_values [
{1000, "M"},
{900, "CM"},
{500, "D"},
{400, "CD"},
{100, "C"},
{90, "XC"},
{50, "L"},
{40, "XL"},
{10, "X"},
{9, "IX"},
{5, "V"},
{4, "IV"},
{1, "I"}
] # using keyowrd list instead of map because ordering is important

@doc """
Convert the number to a roman number.
"""
@spec numerals(pos_integer) :: String.t
def numerals(0) do
""
end
def numerals(number) do
@roman_values |> Enum.find(fn({arabic, roman}) -> number >= arabic end) |> fn({arabic, roman}) ->
roman <> numerals(number - arabic)
end.()
end
enddefmodule Roman do
@roman_values [
{1000, "M"},
{900, "CM"},
{500, "D"},
{400, "CD"},
{100, "C"},
{90, "XC"},
{50, "L"},
{40, "XL"},
{10, "X"},
{9, "IX"},
{5, "V"},
{4, "IV"},
{1, "I"}
] # using keyowrd list instead of map because ordering is important

@doc """
Convert the number to a roman number.
"""
@spec numerals(pos_integer) :: String.t
def numerals(0) do
""
end
def numerals(number) do
@roman_values |> Enum.find(fn({arabic, roman}) -> number >= arabic end) |> fn({arabic, roman}) ->
roman <> numerals(number - arabic)
end.()
end
end

0 comments on commit 5429c89

Please sign in to comment.