Opportunity
Walter Bright
newshound2 at digitalmars.com
Tue Apr 9 12:08:53 PDT 2013
On 4/9/2013 1:17 AM, Russel Winder wrote:
> I have yet to find anyone who can tell me why Go must have generics with
> a cogent argument that makes sense to me.
Can Go do this:
--------------
import std.stdio;
import std.array;
import std.algorithm;
void main() {
stdin.byLine(KeepTerminator.yes).
map!(a => a.idup).
array.
sort.
copy(
stdout.lockingTextWriter());
}
------------
(Read lines from stdin, sort the lines, write the sorted result to stdout.)
This makes heavy use of generics in order to implement pipeline programming.
More information about the Digitalmars-d
mailing list