Re: DLang Front Page Code Example

2014-05-22 Thread bearophile via Digitalmars-d-learn
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,

DLang Front Page Code Example

2014-05-21 Thread Nicholas Londey via Digitalmars-d-learn
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