http://d.puremagic.com/issues/show_bug.cgi?id=6621
Summary: Superimposition amount for std.range.chunks Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-09-08 00:29:12 PDT --- std.range.chunks is quite useful. For it a rather useful third optional argument (that defaults to 0) is how many items are repeated from the precedent chunk: auto data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; chunks(data, 3, 0) ==> (default, as now) [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]] chunks(data, 3, 1) ==> [[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9], [9, 10]] chunks(data, 3, 2) ==> [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10]] In Python I use now and then a lazy generator with such extra argument. The third argument can't be higher than the second (if they are equal it's like cycle on a slice). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------