Again a challenge from 99 Elm problems
Convert a list to a list of lists where repeated elements of the source list are packed into sublists. Elements that are not repeated should be placed in a one element sublist.
pack [1,1,1,2,3,3,3,4,4,4,4,5,6,6] == [ [1,1,1] , [2] , [3, 3, 3] , [4, 4, 4, 4] , [5] , [6, 6] ]
Top comments (3)
For now I have this. Can you guess what's wrong with this code?
Should
[1, 2, 1]be converted to[[1], [2], [1]]or to[[1, 1], [2]]?To [[1], [2], [1]]