On Sunday, 29 January 2017 at 21:41:57 UTC, albert-j wrote:
On Saturday, 28 January 2017 at 11:54:58 UTC, cym13 wrote:
[...]
I am trying to wrap my head around lazy evaluation during
filtering/mapping, but there's something I don't understand.
I want to create an array, square some elements, remove some
elements from original array and add the squared ones to the
original array:
[...]
You need to do something like this:
auto arrMap = arr.filter!(x => x > 5).map!(x => x^^2).array;
It's because arrMap is lazy evaluated.