X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent05%2FMain.hs;h=5dab7c10137b0ab821b956ab50a43d9c2e5571b0;hb=f2c85a0f3caf4338314da60dd2c7823a4dad626c;hp=002b8f58e802504820a20a9eeb585570a958e8d7;hpb=f8648c0ce55739dcadf19bbcdd56d5e48cd4f2e6;p=advent-of-code-23.git diff --git a/advent05/Main.hs b/advent05/Main.hs index 002b8f5..5dab7c1 100644 --- a/advent05/Main.hs +++ b/advent05/Main.hs @@ -54,7 +54,6 @@ useRule (Rule (Iv rl rh) d) (Iv xl xh) = (newResults, newVals, newRules) newVals = filter legalInterval [Iv (max xl (rh + 1)) (max xh rh)] -- input above rule newRules = filter legalRule [Rule (Iv (max (xh + 1) rl) (max xh rh)) d] -- rule above input - useRules :: [Rule] -> [Interval] -> [Interval] useRules [] vals = vals useRules _ [] = [] @@ -64,7 +63,6 @@ useRules (r@(Rule (Iv rl rh) _):rs) (v@(Iv xl xh):vs) | otherwise = newResults ++ (useRules (newRules ++ rs) (newVals ++ vs)) where (newResults, newVals, newRules) = useRule r v - legalInterval :: Interval -> Bool legalInterval (Iv l h) = l <= h