Returns list of lists containing count elements each, where each new chunk starts step elements into the enumerable.

Properties

  • array: Location of the list to chunk
  • count: The number of elements for the new chunk (list)
  • step: The steps into the enumerable each new chunk starts
  • leftover: The value to fill the last chunk if not completely filled

Output

  • output-location: Location to store the output data

For example

Let’s say we have a list with six elements.

Target: Location of the original list

[1, 2, 3, 4, 5, 6]

Group the chunk in elements of three.
Count: 3

The start of each chunk to start two steps into the enumerable
Step: 2

If the last chunk is not completely filled, include this value to the end.
Leftover: 7

Result
[[1, 2, 3], [3, 4, 5], [5, 6, 7]]
0 0 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments