Permutations: Difference between revisions

+ third D entry
(Removed one bug from the second D entry)
(+ third D entry)
Line 891:
[3, 1, 2]
[3, 2, 1]</pre>
===FasterFast Lazy Version===
Compiled with <code>-version=permutations2_main</code> produces the same output:
<lang d>import std.algorithm, std.conv, std.traits;
Line 978:
foreach (p; permutations!false([B(1), B(2), B(3)])) {}
}
}</lang>
===Standard Version===
<lang d>import std.stdio, std.algorithm;
 
void main() {
auto items = [1, 2, 3];
do
writeln(items);
while (items.nextPermutation());
}</lang>