Is there a smart way to process a range of range by front ?

BBasile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 23 14:17:27 PDT 2015


On Wednesday, 23 September 2015 at 21:04:44 UTC, Justin Whear 
wrote:
> On Wed, 23 Sep 2015 20:48:03 +0000, BBasile wrote:
>
>> I was thinking to a general *interleave()* algorithm for any 
>> compatible Range of Range but I can't find any smart way to 
>> process each sub range by front
>
> Can you show a sample input and output to clarify what you mean 
> by interleave?  It's possible that what you want is 
> std.range.frontTransversal, std.range.transversal, or 
> std.range.transposed.

---
auto r0 = [[0,2],[1,3]];
auto r1 = interleave(r0);
assert(r1 = [0,1,2,3]);
auto r2 = [[0,3],[1,4],[2,5]];
auto r3 = interleave(r2);
assert(r3 = [0,1,2,3,4,5]);
---

the fact that the numbers are ordered is just an helper.




More information about the Digitalmars-d-learn mailing list