[Issue 10762] std.range.iota should support any type that has ordered comparisons, incrementing, and addition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 6 03:41:26 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10762



--- Comment #5 from monarchdodra at gmail.com 2013-08-06 03:41:22 PDT ---
(In reply to comment #4)
> 2) Should we optimize iota(start,end,inc) in the case that I supports integer
> multiplication? That is to say, if n is an integer, and n*inc (or inc*n) is a
> type that can be added to values of type C, then we could potentially return a
> random access range wherein opIndex returns start + i*inc as long as the result
> < end (we can throw a RangeError if result !< end). This might be a nice
> optimization for things like BigInt in some cases.

I think providing RA is possible, but at the same time, I doubt there is much
usecase for it. iota's prime usecase is iteration I mean. If we can make it
happen, then great I guess, but I don't really see it as essential.

> 3) If start+inc is *not* supported, but start++ is, then should we support
> iota(start,end)?
> 
> 4) If start+inc is *not* supported but start-- is, and end < start, should we
> support iota(start,end)?

I think that for "iota(end)/iota(start, end)", the constraint should be that
"++"/"--" works. For "iota(start, end, step)", then the constraint should be
"+=".

So I to answer your question, I think that "Yes", we should support iota(start,
end) as soon as ++/-- is available.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list