Java streams Vs LINQ Vs D

bearophile bearophileHUGS at lycos.com
Wed Mar 27 18:04:26 PDT 2013


Chris Cain:

> import std.algorithm : chain, map, copy;
> import std.stdio;
>
> void main() {
>     ["Anders", "David", "James", "Jeff", "Joe", "Erik"]
>         .map!(str => chain("Hello! ", str, "\n"))
>         .copy(stdout.lockingTextWriter());
> }
>
>
> Will do it as well.

Right. forEach() has the advantage of being an unversal "sink".

Bye,
bearophile


More information about the Digitalmars-d mailing list