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