From: Neil Smith Date: Wed, 6 Dec 2023 11:52:58 +0000 (+0000) Subject: Tidying X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=294c56539984358d1043c6c2bf7ae1f28eb88dff;p=advent-of-code-23.git Tidying --- diff --git a/advent05/Main.hs b/advent05/Main.hs index a01860c..17e38bd 100644 --- a/advent05/Main.hs +++ b/advent05/Main.hs @@ -49,10 +49,13 @@ followRequirements almanac (Requirement name vals) = useRule :: Rule -> Interval -> ([Interval], [Interval], [Rule]) useRule (Rule (Iv rl rh) d) (Iv xl xh) = (newResults, newVals, newRules) where newResults = - filter legalInterval [ Iv xl (rl - 1) -- input below rule - , Iv ((max xl rl) + d) ((min xh rh) + d)] -- input within rule - newVals = filter legalInterval [Iv (rh + 1) xh] -- input above rule - newRules = filter legalRule [Rule (Iv (xh + 1) rh) d] -- rule above input + filter legalInterval + [ Iv xl (rl - 1) -- input below rule + , Iv ((max xl rl) + d) ((min xh rh) + d)] -- input within rule + newVals = filter legalInterval + [Iv (rh + 1) xh] -- input above rule + newRules = filter legalRule + [Rule (Iv (xh + 1) rh) d] -- rule above input useRules :: [Rule] -> [Interval] -> [Interval]