diff --git a/day1.exs b/day1.exs index 08b99b7..66aa809 100644 --- a/day1.exs +++ b/day1.exs @@ -1,8 +1,8 @@ defmodule Day1 do @initial_state %{found: [], sum: 0} - def get_numlist do - File.stream!("day1.in") + def input() do + File.stream!("input/day1.in") |> Stream.map(&String.to_integer(String.trim(&1))) end @@ -27,6 +27,6 @@ defmodule Day1 do end end -numlist = Day1.get_numlist() +numlist = Day1.input() IO.puts(Enum.sum(numlist)) Day1.find_first_repeat(numlist) diff --git a/day2.exs b/day2.exs index 620ba5a..6aa5ff0 100644 --- a/day2.exs +++ b/day2.exs @@ -1,11 +1,11 @@ defmodule Day2 do - def get_lines() do - File.stream!("day2.in") + def input() do + File.stream!("input/day2.in") |> Stream.map(&String.trim/1) end def find_subcount(count) do - get_lines() + input() |> Enum.reduce(0, fn x, acc -> if x |> String.graphemes() @@ -22,7 +22,7 @@ defmodule Day2 do end def find_common_chars() do - get_lines() + input() |> Enum.reduce(%MapSet{}, fn x, acc -> x |> String.graphemes() diff --git a/day1.in b/input/day1.in similarity index 100% rename from day1.in rename to input/day1.in diff --git a/day2.in b/input/day2.in similarity index 100% rename from day2.in rename to input/day2.in