Closed iautom8things closed 4 years ago
Hi @iautom8things, thanks for using our theme.
I'll work on it. Can you give me that code snippet?
Hi @diogomoretti ! Thank you!
@spec reduce(t, (element, acc -> acc)) :: acc
def reduce(enumerable, fun)
def reduce([h | t], fun) do
reduce(t, h, fun)
end
def reduce([], _fun) do
raise Enum.EmptyError
end
def reduce(enumerable, fun) do
Enumerable.reduce(enumerable, {:cont, :first}, fn
x, {:acc, acc} -> {:cont, {:acc, fun.(x, acc)}}
x, :first -> {:cont, {:acc, x}}
end)
|> elem(1)
|> case do
:first -> raise Enum.EmptyError
{:acc, acc} -> acc
end
end
Hi @iautom8things, what do you think?
Love it! Thank you :)!
Published on v0.1.5
. Thanks!
Almost perfect! So I mostly work in Elixir. Some themes show a distinction between module names and function names. Not sure if you could add a second variation, but it'd be great if Lukin could distinguish between them, as well!
(The other theme is Atelier Cave Dark)