aldanor:
auto lines = stdin.byLine.map!(line => line.length);writefln("Average line length: %.4f.", 1.0 * lines.sum / lines.array.length);Ofc this is not the greatest piece of code ever and it's not lazy,
lines.walklength seems better than lines.array.length, but you can also use a reduce with two functions (a sum and a counting one), scanning the input file only once.
oh wait, that and a lack of a "mean" function in the standard library...
Yes, it's worth adding to Phobos. Bye, bearophile
