Circular Buffer

Chris Cain clcain at uncg.edu
Sun Feb 9 23:43:28 PST 2014


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?
>
> Example of some ideal "takeBack" function:
> data = cycle([1,2,3][])
> take(data, 4) is [1,2,3,1][]
> takeBack(data, 4) would be [1,3,2,1][]
>
> Thoughts?

Probably what you're looking for:
http://dlang.org/phobos/std_range.html#.retro


More information about the Digitalmars-d-learn mailing list