But it's easy to avoid the multiplication and replace it with a conditional neg.Bye, bearophileHow would you do this ?map!(a => (a.index & 1) ? a : -a)([1, 2]) ? (index field isn't available of course)
import std.range; import std.algorithm; import std.stdio; void main() { auto myRange = iota(0,10); auto index = sequence!((a,n) => a[0]+n)(1);auto result = myRange.zip(index).map!(a => a[1] & 1 ? a[0] : -a[0]);
result.writeln; }