chore: make reduce more iter.Seq
This commit is contained in:
3 files changed
+18
-5
No files matched your search
@@ -32,14 +32,14 @@ func run(scan *bufio.Scanner) (*result, error) {
|
||||
r.valuePT1 = aoc.Reduce(func(i int, t string, sum int) int {
|
||||
sum += hash(t)
|
||||
return sum
|
||||
}, 0, ops...)
|
||||
}, 0, slices.Values(ops))
|
||||
}
|
||||
|
||||
var boxen boxes
|
||||
|
||||
boxen = aoc.Reduce(func(i int, op string, b boxes) boxes {
|
||||
return b.Op(op)
|
||||
}, boxen, ops...)
|
||||
}, boxen, slices.Values(ops))
|
||||
|
||||
r.valuePT2 = boxen.Sum()
|
||||
|
||||
|
||||
Reference in new issue
Block a user