Skip to content

Commit

Permalink
🔨 Use parse_game directly for reduce, in day 2.
Browse files Browse the repository at this point in the history
Instead of wrapping it in a lambda.
  • Loading branch information
simonrainerson committed Dec 13, 2023
1 parent 4baa32d commit d639d84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions advent_of_code/lib/day_2.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Game do
game
end

defp parse_game(game, text) do
defp parse_game(text, game) do
text
|> String.trim()
|> String.split(" ")
Expand All @@ -28,7 +28,7 @@ defmodule Game do
|> List.first()
|> String.split(";")
|> Enum.flat_map(&String.split(&1, ","))
|> Enum.reduce(game, fn cubes, game -> parse_game(game, cubes) end)
|> Enum.reduce(game, &parse_game/2)
end
end

Expand Down

0 comments on commit d639d84

Please sign in to comment.