matovitch:
I got a problem which I'm sure can be solved by a smart one liner. I would like to obtain the term by term product of a given range by the infinite cyclic range cycle([1,-1]). How can I do that ?
void main() { import std.stdio, std.range, std.algorithm; auto r = [10, 20, 30, 40, 50]; auto p = cycle([1, -1]); auto result = r.zip(p).map!(rp => rp[0] * rp[1]); result.writeln; }But it's easy to avoid the multiplication and replace it with a conditional neg.
Bye, bearophile