From 8e84018463c477631bf8df70be238ecea88b0807 Mon Sep 17 00:00:00 2001 From: justin Date: Wed, 13 Dec 2023 08:28:00 +0000 Subject: [PATCH] streamline day 13 more --- src/AOC/Challenge/Day13.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AOC/Challenge/Day13.hs b/src/AOC/Challenge/Day13.hs index 60a59d5..cd03cca 100644 --- a/src/AOC/Challenge/Day13.hs +++ b/src/AOC/Challenge/Day13.hs @@ -21,6 +21,7 @@ import Data.IntMap (IntMap) import qualified Data.IntMap as IM import Data.IntSet (IntSet) import qualified Data.IntSet as IS +import Data.List (find) import Data.List.Split (splitOn) import Data.Maybe (listToMaybe) import Data.Set (Set) @@ -61,8 +62,10 @@ day13a = findSmudge :: Set Point -> Maybe Int findSmudge pts = flip firstJust (fillBoundingBox' pts) \pt -> - let newRefl = IS.fromList $ findRefl (over (contains pt) not pts) - in fst <$> IS.minView (newRefl `IS.difference` origRefl) + find (`IS.notMember` origRefl) + . findRefl + . over (contains pt) not + $ pts where origRefl = IS.fromList $ findRefl pts