What exactly is wrong?
Removed OS specific since same happens on windows.
Comment #2 by knud — 2013-03-17T01:46:20Z
(In reply to comment #1)
> What exactly is wrong?
The second filter don't work, but it should.
>
> Removed OS specific since same happens on windows.
Comment #3 by simen.kjaras — 2019-08-09T06:43:20Z
The map function changes the contents of the array, and unsurprisingly, that changes what the filter filters. This is not a bug in filter and map, but in your code.
Reduced example:
auto arr = [[false]];
writeln(arr.filter!(a => a[0]).map!(a => a[0] = true)); // []
writeln(arr.filter!(a => !a[0]).map!(a => a[0] = true)); // [true]
writeln(arr.filter!(a => a[0]).map!(a => a[0] = true)); // [false]
This is possibly caused by a misguided idea that the array is a value type.