Merging two arrays in a uniform order
Era Scarecrow via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 13 14:01:56 PST 2017
On Friday, 13 January 2017 at 19:47:38 UTC, aberba wrote:
> awesome. roundRobin? :)
https://dlang.org/phobos/std_range.html#.roundRobin
[quote]
roundRobin(r1, r2, r3) yields r1.front, then r2.front, then
r3.front, after which it pops off one element from each and
continues again from r1. For example, if two ranges are involved,
it alternately yields elements off the two ranges. roundRobin
stops after it has consumed all ranges (skipping over the ones
that finish early).
roundRobin can be used to create "interleave" functionality which
inserts an element between each element in a range.
[/quote]
More information about the Digitalmars-d-learn
mailing list