Anonymous user
List comprehensions: Difference between revisions
m
→{{header|D}}
(Updates example with macros to compile with Nim version 1.4.) |
m (→{{header|D}}) |
||
Line 643:
=={{header|D}}==
D doesn't have list comprehensions. One implementation:
<lang d>import std.stdio, std.
TA[] select(TA, TI1, TC1, TI2, TC2, TI3, TC3, TP)
Line 652:
lazy TP where) {
Appender!(TA[]) result;
auto iters =
foreach (el1; items1) {
Line 666:
}
return result.data;
}
Line 676:
iota(y, n + 1), x*x + y*y == z*z);
writeln(r);
}
}</lang>
{{out}}
|