std.range.iota enhancement: supporting more types (AKA issue 10762)

Francesco Cattoglio francesco.cattoglio at gmail.com
Tue Dec 24 04:02:53 PST 2013


On Tuesday, 24 December 2013 at 11:47:12 UTC, Francesco Cattoglio 
wrote:
> Correct, but there's no way to compute "back" with less than 
> O(n) complexity, unless division by increment is available.

I would like to add that I want to compute back because the 
current documentation states: Returns a range that goes through 
the numbers begin, begin + step, begin + 2 * step, ..., up to and 
excluding end.
Up to and excluding seems perfectly reasonable, and others have 
agreed that allowing the user to write iota(4, 9, 2) can be a 
nice idea. Another nice example:

iota(DateTime(2012, 1, 1), DateTime(2013, 1, 1), dur!"days"(5));
can you easily tell what is the "back" element?


More information about the Digitalmars-d mailing list