Stanislav Blinov:
We need generic enumerate() in Phobos :(
It will come soon :-) https://github.com/D-Programming-Language/phobos/pull/1866 (Take a look at my comment about foreach there) This also shows we need a good syntax to unpack tuples:
void main() { auto myRange = iota(0,10);auto result = myRange.enumerate.map!(a => a[0] & 1 ? -a[1] : a[1]);result.writeln; }
It could be written like: myRange.enumerate.map!(t{i, x} => i % 2 ? -x : x); Bye, bearophile