From 833fcf24d661ef600d00c017ce7796b2fc938a17 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 27 Dec 2020 14:09:22 +0100 Subject: Day 20 --- 2020/19.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to '2020/19.hs') diff --git a/2020/19.hs b/2020/19.hs index 3ae886f..a3afb8f 100644 --- a/2020/19.hs +++ b/2020/19.hs @@ -34,8 +34,7 @@ matches :: Gram -> [Int] -> String -> Bool matches _ [] [] = True matches gram@(Gram arr) (r:rs) (c:cs) = case arr A.! r of - S c' | c == c' -> matches gram rs cs - | otherwise -> False + S c' -> c == c' && matches gram rs cs D alts -> any (\alt -> matches gram (alt ++ rs) (c:cs)) alts matches _ _ _ = False -- cgit v1.2.3-54-g00ecf