99 Elm Problems/Problem 9/Solutions
Solution 1: Recursive version
pack list =
case list of
[] -> []
[ x ] -> [ [ x ] ]
x :: xs ->
case pack xs of
[] -> []
x' :: xs' ->
if List.member x x' then
(x :: x') :: xs'
else
[ x ] :: x' :: xs'