A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
13
Task/Matrix-transposition/D/matrix-transposition-2.d
Normal file
13
Task/Matrix-transposition/D/matrix-transposition-2.d
Normal file
|
|
@ -0,0 +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))();
|
||||
}
|
||||
|
||||
void main() {
|
||||
enum M = [[10, 11, 12, 13],
|
||||
[14, 15, 16, 17],
|
||||
[18, 19, 20, 21]];
|
||||
/*immutable*/ auto T = transpose(M);
|
||||
writefln("%(%(%2d %)\n%)", T);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue