range chunks

bearophile bearophileHUGS at lycos.com
Fri Aug 6 16:52:09 PDT 2010


Philippe Sigaud:
> > It's better to give it a default chunk size of 2.
> 
> Why?

I'm using partition() for years in various languages, and I've seen that the chunks of size 2 are the most common.


> And what should the default step be, according to you? If chose n (the chunk
> size), because that's want the OP wanted.

No duplication across chunks, so on default it can split the natural numbers as:
[1, 2], [3, 4], [5, 6], etc.


> Yeah, partition, chunk, segment, it a basic thing, worth including in
> std.range.

The most common name is partition().

Bye,
bearophile


More information about the Digitalmars-d mailing list