From: Neil Smith Date: Mon, 11 Dec 2023 11:14:19 +0000 (+0000) Subject: Added link to blog X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=d2427d370c43ca58800f203a6b7dcbd5a815c5a8;p=advent-of-code-23.git Added link to blog --- diff --git a/advent11/Main.hs b/advent11/Main.hs index 283060d..cfdbe0e 100644 --- a/advent11/Main.hs +++ b/advent11/Main.hs @@ -1,4 +1,4 @@ --- Writeup at https://work.njae.me.uk/2023/12/10/advent-of-code-2023-day-10/ +-- Writeup at https://work.njae.me.uk/2023/12/11/advent-of-code-2023-day-11/ import AoC @@ -29,7 +29,8 @@ part2 galaxies = allDistances $ expandGalaxies galaxies (10^6) allDistances :: Galaxies -> Int allDistances gs = case S.minView gs of Nothing -> 0 - Just (g, gs') -> (S.foldl' (addDist g) 0 gs) + allDistances gs' + Just (g, gs') -> (S.foldl' ( + addDist g) 0 gs) + allDistances gs' where addDist g1 acc g2 = acc + distance g1 g2 distance :: Position -> Position -> Int