On Wednesday, 21 October 2020 at 13:04:40 UTC, Ferhat Kurtulmuş wrote:
import std.range;
import std.stdio;

void main(){
    auto source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    auto chunks = chunks(source, 2);

    writeln(chunks[0]); // [1, 2]

    foreach(c; chunks)
        writeln(c[1]);
}

And, thank you Kurtulmuṣ (that's the closest "s" this keyboard has).

I've played with std.range but didn't think a control structure or import should be necessary.


Reply via email to