www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8555] New: Round Robin and Infinite Ranges

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8555

           Summary: Round Robin and Infinite Ranges
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: daniel350 bigpond.com



PDT ---
http://dlang.org/phobos/std_range.html#roundRobin

As would be expected, RoundRobin goes into an infinite loop if the range is
infinite; perhaps !isInfinite!R would be suitable to test against the input
ranges?
This may benefit other exhausting range functions also.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8555


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

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



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: -------
Jan 01 2013