10 lines
171 B
Haskell
10 lines
171 B
Haskell
compress :: (Eq a) => [a] -> [a]
|
|
compress =
|
|
foldr
|
|
( \x acc ->
|
|
if acc /= []
|
|
&& x == head acc
|
|
then acc
|
|
else x : acc
|
|
)
|
|
[]
|