Multiplication tables: Difference between revisions

Updated D entry
(Added Bracmat example)
(Updated D entry)
Line 868:
=={{header|D}}==
{{trans|PicoLisp}}
<lang d>void main() {
<lang d>import std.stdio, std.array, std.range, std.algorithm;
alias R = import std.stdio, std.array, std.range, std.replicatealgorithm;
 
void main() {
enum n = 12;
writefln(" %(%4d%)\n%s", iota(1, n + 1), "-".Rreplicate(4 * (n + 1)));
foreach (immutable y; 1 .. n + 1)
writefln("%4d" ~ " ".Rreplicate(4 * (y - 1)) ~ "%(%4d%)", y,
iota(y, n + 1).map!(x => x * y));
}</lang>