Yields non-overlapping chunks (tuples) of length from the input iterator.
length
The length of each chunk, must be greater than 0.
Optional
Optional, the value to fill the last chunk with if it's not the same length as the rest of the iterator.
[...chunks([1,2,3,4,5,6,7,8,9], 3)] // [[1,2,3], [4,5,6], [7,8,9]][...chunks([1,2,3,4,5,6,7,8,9], 2, 0)] // [[1,2], [3,4], [5,6], [7,8], [9, 0]] Copy
[...chunks([1,2,3,4,5,6,7,8,9], 3)] // [[1,2,3], [4,5,6], [7,8,9]][...chunks([1,2,3,4,5,6,7,8,9], 2, 0)] // [[1,2], [3,4], [5,6], [7,8], [9, 0]]
Yields non-overlapping chunks (tuples) of
length
from the input iterator.