[phobos] advance() for infinite random access ranges?

Denis 2korden at gmail.com
Sat Aug 14 17:35:48 PDT 2010


On Sun, Aug 15, 2010 at 4:29 AM, David Simcha <dsimcha at gmail.com> wrote:
> I've thought some more about how to support slicing in the case of
> take(someInfiniteRange, someNumber) and I think it would be a good idea to
> require infinite random-access ranges to support an advance() function.
>  This would basically be like slicing, but only change the beginning of the
> range, not the end (since there is no end of an infinite range).  Calling
> infiniteRange.advance(N) would be equivalent to calling
> infiniteRange.popFront() N times, except that advance() would have O(1) time
> complexity.  Sound good?  Any alternative suggestions?
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>

O(1) advance() is not always possible (not that it means your
suggestion is bad).


More information about the phobos mailing list