www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8278] New: std.range.chunks for generic Forward Ranges too?

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

           Summary: std.range.chunks for generic Forward Ranges too?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



From the online docs of std.range.chunks:

This range iterates over fixed-sized chunks of size chunkSize of a source
range. Source must be an input range with slicing and length.

Is it possible to modify chunks() to allow it to also work on forward ranges
that have no slicing and lenght?

An example is chunking the output of recurrence():

auto r = recurrence!q{(22695477 * a[n-1] + 12345) % 1073741824}(123456789U);
auto c = std.range.chunks(r, 5);

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