elm-community/list-split/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

List.Split

Split lists into chunks

Splitters

chunksOfLeft : Int -> List a -> List (List a)

Split list into smaller lists of length k, starting from the left.

chunksOfLeft 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]]
chunksOfLeft 3 [1,2,3,4,5,6,7,8] == [[1,2,3],[4,5,6],[7,8]]
chunksOfLeft 3 [] == [[]]
chunksOfRight : Int -> List a -> List (List a)

Split list into smaller lists of length k, starting from the right.

chunksOfRight 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]]
chunksOfRight 3 [1,2,3,4,5,6,7,8] == [[1,2], [3,4,5], [6,7,8]]
chunksOfRight 3 [] == [[]]