Simplify with Enum.into/2
This commit is contained in:
parent
fcbf4aa683
commit
04970d3ed6
1 changed files with 2 additions and 4 deletions
|
@ -5,8 +5,7 @@ defmodule Day8 do
|
||||||
antennas
|
antennas
|
||||||
|> find_pairs()
|
|> find_pairs()
|
||||||
|> Enum.flat_map(fn pair -> find_antinodes(pair, x, y) end)
|
|> Enum.flat_map(fn pair -> find_antinodes(pair, x, y) end)
|
||||||
|> MapSet.new()
|
|> Enum.into(antinodes)
|
||||||
|> MapSet.union(antinodes)
|
|
||||||
end)
|
end)
|
||||||
|> MapSet.size()
|
|> MapSet.size()
|
||||||
end
|
end
|
||||||
|
@ -30,8 +29,7 @@ defmodule Day8 do
|
||||||
antennas
|
antennas
|
||||||
|> find_pairs()
|
|> find_pairs()
|
||||||
|> Enum.flat_map(fn pair -> find_resonant_harmonics(pair, x, y) end)
|
|> Enum.flat_map(fn pair -> find_resonant_harmonics(pair, x, y) end)
|
||||||
|> MapSet.new()
|
|> Enum.into(antinodes)
|
||||||
|> MapSet.union(antinodes)
|
|
||||||
end)
|
end)
|
||||||
|> MapSet.size()
|
|> MapSet.size()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue