From 19d4b4e41a967c0c8b3329cd1c4a0617178c5a94 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Tue, 17 Dec 2024 19:47:14 +0100 Subject: Lean 4.14 --- Day3.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Day3.lean') diff --git a/Day3.lean b/Day3.lean index fd6fbc8..00ef709 100644 --- a/Day3.lean +++ b/Day3.lean @@ -103,7 +103,7 @@ def part2 (schematic : Schematic) : Nat := -- because here we need quick lookup for the numbers, not the parts. open Std(HashMap) in let numberCoordinates : HashMap Coordinate PartNumber := - HashMap.ofList $ schematic.numbers.bind $ λ pn ↦ pn.positions.map (·, pn) + HashMap.ofList $ schematic.numbers.flatMap $ λ pn ↦ pn.positions.map (·, pn) let gearSymbols := schematic.parts.filter (Part.symbol · == '*') -- but the symbols aren't enough, they need to be adjacent to **exactly** 2 numbers let numbersNextGearSymbols := List.eraseReps <$> gearSymbols.map λgs ↦ -- cgit v1.2.3