Joseph Rushton Wakeling:

How does your desired concept relate to the existing std.algorithm.nextPermutation ... ?

The API of the lazy permutations/combinations ranges is similar to the one I have written here:
http://rosettacode.org/wiki/Permutations#Fast_Lazy_Version

That is also very similar to the permutations/combinations here (with the "r" optional argument):
http://docs.python.org/2/library/itertools.html


To the one in Phobos is used like:

auto items = [1, 2, 3];
do
    writeln(items);
while (items.nextPermutation());


The permutations/combinations range is used like (the boolean template argument is to specify if it has to copy the buffer or not):

[1, 2, 3].permutations!false.writeln;

Bye,
bearophile

Reply via email to