Generating all combinations of length X in an array

wobbles via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 8 04:19:22 PDT 2015


On Wednesday, 8 April 2015 at 11:08:00 UTC, wobbles wrote:
> On Wednesday, 8 April 2015 at 10:54:45 UTC, bearophile wrote:
>> wobbles:
>>
>>> While trying to generate all combinations of length X in an 
>>> array,
>>> I came across the question on stackoverflow. [1]
>>>
>>> Theres a couple good answers there, but one that caught my 
>>> eye shows a C# code snippet that is quite nice and short:
>>
>> Often short code is not the best code.
>>
>> Take a look at the versions here, the usable one is the third:
>> http://rosettacode.org/wiki/Combinations#D
>>
>> Bye,
>> bearophile
>
> Ah, excellent! Dunno why I didnt think of rosettacode before.
>
> Is the 3rd version usable at compile time?
>
> Thanks, all the D stuff on rosettacode is an excellent resource!

Have just tested, it is!


More information about the Digitalmars-d-learn mailing list