From 733a760558ccbb030b2c7689a486247f105dd90b Mon Sep 17 00:00:00 2001 From: Packy Anderson Date: Thu, 23 May 2024 02:37:19 -0400 Subject: Challenge 270 - update Elixir solution --- challenge-270/packy-anderson/elixir/ch-1.exs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/challenge-270/packy-anderson/elixir/ch-1.exs b/challenge-270/packy-anderson/elixir/ch-1.exs index f1e5d6c534..abee770d6c 100755 --- a/challenge-270/packy-anderson/elixir/ch-1.exs +++ b/challenge-270/packy-anderson/elixir/ch-1.exs @@ -3,11 +3,15 @@ defmodule PWC do def sumRow(matrix, i) do - Enum.sum(Enum.at(matrix, i)) + matrix + |> Enum.at(i) + |> Enum.sum end def sumCol(matrix, j) do - Enum.sum(Enum.map(matrix, fn x -> Enum.at(x, j) end)) + matrix + |> Enum.map(fn x -> Enum.at(x, j) end) + |> Enum.sum end def specialPositions(matrix) do -- cgit