From 06c7f38bbf407623dfadfee296b1757a3e8cbd84 Mon Sep 17 00:00:00 2001 From: Samuel Owen Date: Wed, 27 Dec 2023 20:26:34 +0000 Subject: [PATCH] Add sum_map function to Day2 module --- lib/day2/day2.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/day2/day2.ex b/lib/day2/day2.ex index b01cc0b..f31c1a0 100644 --- a/lib/day2/day2.ex +++ b/lib/day2/day2.ex @@ -55,4 +55,8 @@ defmodule Day2 do def extract_integer(string) do remove_non_digits(string) |> String.to_integer() end + + def sum_map(map) do + Map.values(map) |> Enum.sum() + end end