diff options
| -rwxr-xr-x | challenge-270/packy-anderson/elixir/ch-1.exs | 8 |
1 files 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 |
