Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

99 Elm Problems/Problem 9

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists. Elements that are not repeated should be placed in a one element sublist. import Html exposing (text) import List pack : List a -> List (List a) -- your implementation goes here main = pack [1,1,1,2,3,3,3,4,4,4,4,5,6,6] |> toString |> text Result: [[1,1,1], [2], [3, 3, 3], [4, 4, 4, 4], [5], [6, 6]] Solutions