99-haskell-problems/Problems 01-10/problem_08.hs

11 lines
171 B
Haskell
Raw Normal View History

2024-05-24 17:06:42 -05:00
compress :: (Eq a) => [a] -> [a]
compress =
foldr
( \x acc ->
if acc /= []
&& x == head acc
then acc
else x : acc
)
[]