range chunks

Rory Mcguire rjmcguire at gm_no_ail.com
Wed Aug 18 05:59:47 PDT 2010


Peter Alexander wrote:

> On 7/08/10 3:06 PM, bearophile wrote:
>> Peter Alexander:
>>> (I just Googled for "quicksort pseudocode" and sure enough, all of the
>>> top 10 entries that actually contained code defined a partition function
>>> that does what std.algorithm.partition does).
>>
>> Yes, it's named partition in my implementations of Quicksort too :-) So
>> it's better to find a different name for the other one.
> 
> Hmm, how about kPartitions?
> 
> e.g. kPartitions([1,2,3,4,5,6], 3) == [[1,2,3], [4,5,6]]
> 
> A k-partition is common terminology for partitioning a set into
> k-element subsets, so that seems to fit, and isn't too verbose.


how about

std.range.tochunks([1,2,3,4,5,6],3) == [[1,2,3],[4,5,6]]


More information about the Digitalmars-d mailing list