consistent naming
This commit is contained in:
parent
ddcb127761
commit
7d9b68597b
6
day1.exs
6
day1.exs
|
@ -1,8 +1,8 @@
|
||||||
defmodule Day1 do
|
defmodule Day1 do
|
||||||
@initial_state %{found: [], sum: 0}
|
@initial_state %{found: [], sum: 0}
|
||||||
|
|
||||||
def get_numlist do
|
def input() do
|
||||||
File.stream!("day1.in")
|
File.stream!("input/day1.in")
|
||||||
|> Stream.map(&String.to_integer(String.trim(&1)))
|
|> Stream.map(&String.to_integer(String.trim(&1)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,6 +27,6 @@ defmodule Day1 do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
numlist = Day1.get_numlist()
|
numlist = Day1.input()
|
||||||
IO.puts(Enum.sum(numlist))
|
IO.puts(Enum.sum(numlist))
|
||||||
Day1.find_first_repeat(numlist)
|
Day1.find_first_repeat(numlist)
|
||||||
|
|
8
day2.exs
8
day2.exs
|
@ -1,11 +1,11 @@
|
||||||
defmodule Day2 do
|
defmodule Day2 do
|
||||||
def get_lines() do
|
def input() do
|
||||||
File.stream!("day2.in")
|
File.stream!("input/day2.in")
|
||||||
|> Stream.map(&String.trim/1)
|
|> Stream.map(&String.trim/1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_subcount(count) do
|
def find_subcount(count) do
|
||||||
get_lines()
|
input()
|
||||||
|> Enum.reduce(0, fn x, acc ->
|
|> Enum.reduce(0, fn x, acc ->
|
||||||
if x
|
if x
|
||||||
|> String.graphemes()
|
|> String.graphemes()
|
||||||
|
@ -22,7 +22,7 @@ defmodule Day2 do
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_common_chars() do
|
def find_common_chars() do
|
||||||
get_lines()
|
input()
|
||||||
|> Enum.reduce(%MapSet{}, fn x, acc ->
|
|> Enum.reduce(%MapSet{}, fn x, acc ->
|
||||||
x
|
x
|
||||||
|> String.graphemes()
|
|> String.graphemes()
|
||||||
|
|
Loading…
Reference in New Issue