+ 3
devanille my purpose in being here is to teach so please let me. Chunked is meant to rearrange a list into a list of lists.
For example, a list of words and you want to create sentences using two words in each sentence. Taking 10 words from the original list, you'd end up with 5 pairs making up the inner 5 lists being held in the single outer list. Starting with:
listOf("one", "two", ..., "nine", "ten").chunked(2)
yielding:
listOf(listOf("one", "two"), ..., listOf("nine", "ten"))