Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pack' :: (Eq a) => [a] -> [[a]] -> [[a]]
- pack' [] y = y
- pack' (x:xs) [] = pack' xs [[x]]
- pack' (x:xs) (y:ys) = if x == head y then pack' xs ((x:y):ys) else pack' xs ([[x], y]++ys)
- pack :: (Eq a) => [a] -> [[a]]
- pack x = reverse (pack' x [])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement