From 04970d3ed6464d60ff1e4475c2fb9d9467d0cea4 Mon Sep 17 00:00:00 2001 From: Adam Millerchip Date: Mon, 9 Dec 2024 12:23:29 +0900 Subject: [PATCH] Simplify with Enum.into/2 --- 2024/day8.exs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/2024/day8.exs b/2024/day8.exs index 32b7f91..b515444 100755 --- a/2024/day8.exs +++ b/2024/day8.exs @@ -5,8 +5,7 @@ defmodule Day8 do antennas |> find_pairs() |> Enum.flat_map(fn pair -> find_antinodes(pair, x, y) end) - |> MapSet.new() - |> MapSet.union(antinodes) + |> Enum.into(antinodes) end) |> MapSet.size() end @@ -30,8 +29,7 @@ defmodule Day8 do antennas |> find_pairs() |> Enum.flat_map(fn pair -> find_resonant_harmonics(pair, x, y) end) - |> MapSet.new() - |> MapSet.union(antinodes) + |> Enum.into(antinodes) end) |> MapSet.size() end