On Monday, 10 February 2014 at 03:14:31 UTC, Jonathan Dunlap wrote:
(disclaimer: I'm new around here)
Is it possible to cycle backwards? If not, what's the best approach?

import std.algorithm;
import std.array;
import std.range;
import std.stdio;

void main(string[] args)
{
        auto data = [1,2,3];

        assert(data.cycle.take(5).array       == [1,2,3,1,2]);
        assert(data.retro.cycle.take(5).array == [3,2,1,3,2]);
}

Reply via email to