This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -1,13 +1,13 @@
import std.stdio, std.algorithm, std.range;
auto transpose(T)(in T[][] m) /*pure nothrow*/ {
return iota(m[0].length).map!(i => transversal(m, i))();
return m[0].length.iota.map!(i => m.transversal(i));
}
void main() {
enum M = [[10, 11, 12, 13],
[14, 15, 16, 17],
[18, 19, 20, 21]];
/*immutable*/ auto T = transpose(M);
immutable M = [[10, 11, 12, 13],
[14, 15, 16, 17],
[18, 19, 20, 21]];
/*immutable*/ auto T = M.transpose;
writefln("%(%(%2d %)\n%)", T);
}