[Issue 8555] Round Robin and Infinite Ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 1 14:12:33 PST 2013


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


Peter Alexander <peter.alexander.au at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au at gmail.co
                   |                            |m


--- Comment #1 from Peter Alexander <peter.alexander.au at gmail.com> 2013-01-01 14:12:27 PST ---
It's not a good idea to constrain the function unnecessarily. For example, you
might want to construct an infinite round robin, but then take a finite number
of elements from the start.

e.g.

auto r = roundRobin(cycle([0, 1]), cycle([0, 1, 2])).take(10);

This should work, even though cycle is infinite. There's nothing wrong with
infinite ranges, as long as you don't try to iterate them in their entirety :-)

-- 
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