https://issues.dlang.org/show_bug.cgi?id=18975
Issue ID: 18975
Summary: permutations.array creates an array of the original
type without the permutations
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
Weird title, but the problem is that using
permutations.some_lazy_range_algorithm.array returns an array of the original
elements, without the permutations. See code :
--- bug.d
void main()
{
import std.algorithm : permutations;
import std.stdio : writeln;
import std.array : array;
[1, 2, 3].permutations.writeln;
//prints : [[1, 2, 3], [2, 1, 3], [3, 1, 2], [1, 3, 2], [2, 3, 1], [3, 2, 1]]
[1, 2, 3].permutations.array.writeln;
//prints : [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
}
---
bug seems to affect all versions from 2.69 onwards, per run.dlang.io :
https://run.dlang.io/is/PLWWRo
--