<div dir="ltr">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.<br>
<br>What I'd like to see working is this:<br><br>import std.stdio, std.algorithm, std.range;<br><br>void main() {<br> auto printer = fork!(n => n % 2)(sink!(n => writeln("odd: ", n)),<br> sink!(n => writeln("even: ", n)))<br>
.filter!(n => n != 16)<br> .map!(n => n * n);<br><br> copy(iota(10), printer);<br>}<br><br><a href="http://dpaste.dzfl.pl/612a8ad6">http://dpaste.dzfl.pl/612a8ad6</a><br></div>