corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | #!/usr/bin/env rdmd |
2 | // Computes average line length for standard input. |
||
3 | import std.stdio; |
||
4 | |||
5 | void main() { |
||
6 | ulong lines = 0; |
||
7 | double sumLength = 0; |
||
8 | foreach (line; stdin.byLine()) { |
||
9 | ++lines; |
||
10 | sumLength += line.length; |
||
11 | } |
||
12 | writeln("Average line length: ", |
||
13 | lines ? sumLength / lines : 0); |
||
14 | } |