Skip to content

Commit

Permalink
refactor: remove redundant .group
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 authored Dec 4, 2024
1 parent ad825ec commit feda1be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 2024/day03.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def part1(text: String): Int =
def part2(text: String): Int = s"(${mul}|${`do`}|${dont})".r
.findAllMatchIn(text)
.foldLeft((true, 0)) { case ((on, acc), m) =>
m.group(1) match
m match
case mul(a, b) => (on, if on then acc + a.toInt * b.toInt else acc)
case `do`() => (true, acc)
case dont() => (false, acc)
Expand Down

0 comments on commit feda1be

Please sign in to comment.