Bug 18975 – permutations.array creates an array of the original type without the permutations

Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2018-06-12T15:26:39Z
Last change time
2024-12-01T16:33:54Z
Assigned to
No Owner
Creator
someone_i_dont_know
Moved to GitHub: phobos#10340 →

Comments

Comment #0 by someone_i_dont_know — 2018-06-12T15:26:39Z
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
Comment #1 by robert.schadek — 2024-12-01T16:33:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10340 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB