More love for output ranges

Artem Tarasov lomereiter at gmail.com
Sat Oct 12 11:00:43 PDT 2013


We have great support for input ranges and thus for the pull-based model of
programming, but the standard library offers almost nothing for the
push-based model :(  It utterly lacks tools for composing output ranges.

What I'd like to see working is this:

import std.stdio, std.algorithm, std.range;

void main() {
    auto printer = fork!(n => n % 2)(sink!(n => writeln("odd: ", n)),
                                                  sink!(n => writeln("even:
", n)))
        .filter!(n => n != 16)
        .map!(n => n * n);

    copy(iota(10), printer);
}

http://dpaste.dzfl.pl/612a8ad6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131012/c94ef61c/attachment.html>


More information about the Digitalmars-d mailing list