Quick Start with D: few examples and set of links.

John Colvin via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri May 1 07:39:01 PDT 2015


On Friday, 1 May 2015 at 14:01:38 UTC, Anonymous wrote:
> This is great, thank you.
>
> I couldn't get the example in the introduction to work without 
> adding .map!(chomp) to the pipeline:
>
> auto sample = File("10numbers.txt")
>         .byLine
>         .takeExactly(10)
>         .map!(chomp)
> 	.map!(to!double)
>         .tee!((x){mean += x;})
>         .array;
>
> Without that, I got an error converting to a double (my file 
> had '\r' after each number)

Alternatively, byLine(KeepTerminator.no, terminator = 
std.ascii.newline) could help if you know you're dealing with 
native file-endings.


More information about the Digitalmars-d-announce mailing list