ddash.range.chunk

Creates a range consisting of chunks of another range

More...

Members

Functions

chunk
auto chunk(Range range, size_t size)

Creates a range of ranges of length size. If the range can't be split evenly, the final chunk` will be the remaining elements.

Detailed Description

Differences between

<li>phobos.std.range.chunk - treats 0 as a valid chunk size <li>lodash.chunks - none intended

Examples

assert([1, 2, 3].chunk(0).equal((int[][]).init));
assert([1, 2, 3].chunk(1).equal([[1], [2], [3]]));

Meta