Nicholas Londey:
So I tried rewriting the example on the dlang.org home page and
came up with the following.
import std.algorithm, std.exception, std.stdio;
double average(T)(T range)
{
enforce(!range.empty, "No inputs");
auto totals = range.map!(a => tuple(1.0,
cast(double)(a))).reduce
I was looking at this code the other day and thought to my self
"This is terrible D" in the order of the C hello world with no
error handling and returning a junk stack value.
I am a reasonably experienced C++ programmer but still a newbie
at D. However, between the ideals of reusable code and