summaryrefslogblamecommitdiff
path: root/1-10/9.hs
blob: e9630f47ed396a0da5b59a7d6de403ae9801c2e4 (plain) (tree)
1
2
3
4
5




                                                                                 
pack :: Eq a => [a] -> [[a]]

pack [] = []
pack [x] = [[x]]
pack (x:xs) = if x == head y then (x:y):ys else [x]:(y:ys) where (y:ys) = pack xs