D is a general-purpose programming language with static typing, systems-level access, and C-like syntax. With the D Programming Language, write fast, read fast, and run fast. Fast code, fast.

You are watching: D&d helm of brilliance

DConf online 2021 is happening soon. November 20 and 21, 2021. Save the dates!


Got a brief example illustrating D?

Submit your code to the digitalmars.D forum specifying "" in the subject.

Upon approval it will be showcased here on a random schedule.


The D programming languageModern convenience.Modeling power.Native efficiency.

See more: What Does Justin Timberlake Look Like Premium High Res Photos

void main() import std.range, std.stdio; auto sum = 0.0; auto count = stdin //Get an input range set up to read one line at a time .byLine //Perform a transparent operation (as in the shell command tee) .tee!(l => sum += l.length) .walkLength; writeln("Average line length: ", count ? sum / count : 0);
2.4 plus 2.4 equals 5 for sufficiently large values of 2.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;
MercuryVenusEarthMarsJupiterSaturnUranusNeptuneimport std.stdio, std.array, std.algorithm;void main() stdin .byLineCopy .array .sort!((a, b) => a > b) // descending order .each!writeln;
void main() import std.algorithm, std.stdio; "Starting program".writeln; enum a = < 3, 1, 2, 4, 0 >; // Sort data at compile-time static immutable b = sort(a); // Print the result _during_ compilation pragma(msg, "Finished compilation: ", b);
void main() import std.exception, std.stdio, std.process; auto result = <"whoami">.execute; enforce(result.status == 0); result.output.write;
void main() import std.algorithm, std.stdio, std.file, std.range; enum cols = 14; // Split file into 14-byte chunks per row thisExePath.File("rb").byChunk(cols).take(20).each!(chunk => // Use range formatting to format the // hexadecimal part and align the text part writefln!"%(%02X %)%*s %s"( chunk, 3 * (cols - chunk.length), "", // Padding chunk.map!(c => // Replace non-printable c 0x7E ? "." : char(c))));
#!/usr/bin/env dub/+ dub.sdl:dependency "vibe-d" version="~>0.8.0"+/void main() import vibe.d; listenHTTP(":8080", (req, res) res.writeBody("Hello, World: " ~ req.path); ); runApplication();
void main() import std.datetime.stopwatch : benchmark; import std.math, std.parallelism, std.stdio; auto logs = new double<100_000>; auto bm = benchmark!( foreach (i, ref elem; logs) elem = log(1.0 + i); , foreach (i, ref elem; logs.parallel) elem = log(1.0 + i); )(100); // number of executions of each tested function writefln("Linear init: %s msecs", bm<0>.total!"msecs"); writefln("Parallel init: %s msecs", bm<1>.total!"msecs");
void main(){ import std.stdio : writefln; import std.algorithm.sorting : sort; import std.range : chain; int<> arr1 = <4, 9, 7>; int<> arr2 = <5, 2, 1, 10>; int<> arr3 = <6, 8, 3>; //

*
*
*
*
*
*