spelling
This commit is contained in:
parent
406d9cc34d
commit
87fd00fe94
1 changed files with 4 additions and 4 deletions
8
day1.ex
8
day1.ex
|
@ -1,4 +1,4 @@
|
||||||
defmodule Excersize1 do
|
defmodule Exercise1 do
|
||||||
def to_command(s) do
|
def to_command(s) do
|
||||||
try do
|
try do
|
||||||
{:add, s |> String.trim() |> String.to_integer()}
|
{:add, s |> String.trim() |> String.to_integer()}
|
||||||
|
@ -34,10 +34,10 @@ end
|
||||||
|
|
||||||
result = IO.stream() |>
|
result = IO.stream() |>
|
||||||
Enum.reduce_while(
|
Enum.reduce_while(
|
||||||
Excersize1.init_state(),
|
Exercise1.init_state(),
|
||||||
fn line, acc -> line
|
fn line, acc -> line
|
||||||
|> Excersize1.to_command()
|
|> Exercise1.to_command()
|
||||||
|> Excersize1.apply_command(acc)
|
|> Exercise1.apply_command(acc)
|
||||||
|> then(fn acc -> if elem(acc, 2) do {:halt, acc} else {:cont, acc} end end)
|
|> then(fn acc -> if elem(acc, 2) do {:halt, acc} else {:cont, acc} end end)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue