Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed May 1, 2015
1 parent e57fab0 commit 4c26788
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/readdoubles2.d
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import std.algorithm.iteration : map, each;
import std.array : array;
import std.conv : to;
import std.conv : parse;
import std.range : takeExactly, tee;
import std.stdio;
import std.string : chomp;

void main()
{
double mean = 0;
auto sample = File("10numbers.txt")
.byLine
.takeExactly(10)
.map!chomp // removes trailing '\r'
.map!(to!double)
.map!(line => parse!double(line))
.tee!((x){mean += x;})
.array;
mean /= sample.length;
Expand Down

0 comments on commit 4c26788

Please sign in to comment.