Browse Source

Problem 08

completed
Craige McWhirter 7 months ago
parent
commit
4109286c2e
Signed by: craige GPG Key ID: 7DBA9F5689EFB6AA
  1. 13
      compress.hs

13
compress.hs

@ -0,0 +1,13 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- Eliminate consecutive duplicates of list elements.
-- If a list contains repeated elements they should be replaced with a single
-- copy of the element. The order of the elements should not be changed.
import Data.List (group)
compress :: Eq a => [a] -> [a]
compress = map head . group
Loading…
Cancel
Save