diff options
Diffstat (limited to '2021/Util.hs')
-rw-r--r-- | 2021/Util.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/2021/Util.hs b/2021/Util.hs index f021a88..1553c4c 100644 --- a/2021/Util.hs +++ b/2021/Util.hs @@ -13,3 +13,8 @@ splitOn f (x:xs) | f x = [] <| splitOn f xs splits' :: [a] -> [(a, [a])] splits' l = zip l (zipWith (++) (inits l) (tail (tails l))) + +uniq :: Eq a => [a] -> [a] +uniq (x : y : xs) | x == y = uniq (y : xs) + | otherwise = x : uniq (y : xs) +uniq l = l |