day3 done

This commit is contained in:
2022-12-05 00:30:20 +01:00
parent 6bb46e0b8b
commit 4ec9d323c2
3 changed files with 66 additions and 10 deletions

View File

@ -92,13 +92,3 @@ result 'X' = Loss
result 'Y' = Draw
result 'Z' = Win
result c = error $ "malformed Input: "<> show c
-- | Split a list into sublists delimited by the given element.
--
-- From: https://hackage.haskell.org/package/haskell-gi-0.26.2/docs/src/Data.GI.CodeGen.Util.html#splitOn
splitOn :: Eq a => a -> [a] -> [[a]]
splitOn x xs = go xs []
where go [] acc = [reverse acc]
go (y : ys) acc = if x == y
then reverse acc : go ys []
else go ys (y : acc)