Combining infinite ranges
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 2 12:41:17 PDT 2010
On 06/02/2010 02:29 PM, Philippe Sigaud wrote:
>
>
> On Wed, Jun 2, 2010 at 19:57, bearophile <bearophileHUGS at lycos.com
> <mailto:bearophileHUGS at lycos.com>> wrote:
>
> Philippe Sigaud:
> > What, do you also need the no-arg version of iota?
> >
> > :-p
>
> I'd like a generator (range) similar to the Python itertools.count,
> that yields numbers starting from the given number (defaulting to
> zero) and just goes on and on. You can use it in many situations:
> http://docs.python.org/library/itertools.html#itertools.count
>
>
> Yes, it's handy. It's one of the first range I made, a year ago.
iota(n, n.max) is close. Well, it's not infinite, but cycle(iota(n,
n.max)) is. Probably a version using BigInt would be most sensible.
Andrei
More information about the Digitalmars-d
mailing list