Why D is not popular enough?
Guillaume Piolat via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 30 07:25:28 PDT 2016
On Tuesday, 30 August 2016 at 14:11:56 UTC, Andrei Alexandrescu
wrote:
> On 08/30/2016 06:50 AM, John Burrton wrote:
>> This is why the example on the front page put me off for a
>> long time :-
>>
>> stdin
>> .byLineCopy
>> .array
>> .sort!((a, b) => a > b) // descending order
>> .each!writeln;
>
> Sadly if this doesn't float your boat you're unlikely to enjoy
> most of what D has to offer. -- Andrei
That particular bit of code doesn't really ring "pragmatic", just
"clever". Honestly the front page examples are just scary.
// Round floating point numbers
import std.algorithm, std.conv, std.functional,
std.math, std.regex, std.stdio;
alias round = pipe!(to!real, std.math.round, to!string);
static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;
void main()
{
// Replace anything that looks like a real
// number with the rounded equivalent.
stdin
.byLine
.map!(l => l.replaceAll!(c => c.hit.round)
(reFloatingPoint))
.each!writeln;
}
A clever and impractical piece of program that is hard to read
for most programmers.
More information about the Digitalmars-d
mailing list