Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,8 @@
void main() {
import std.stdio, std.range;
/*immutable*/ auto M = [[10, 11, 12, 13],
[14, 15, 16, 17],
[18, 19, 20, 21]];
writefln("%(%(%2d %)\n%)", M.transposed);
}

View file

@ -0,0 +1,16 @@
T[][] transpose(T)(in T[][] m) pure nothrow {
auto r = new typeof(return)(m[0].length, m.length);
foreach (immutable nr, const row; m)
foreach (immutable nc, immutable c; row)
r[nc][nr] = c;
return r;
}
void main() {
import std.stdio;
immutable M = [[10, 11, 12, 13],
[14, 15, 16, 17],
[18, 19, 20, 21]];
writefln("%(%(%2d %)\n%)", M.transpose);
}

View file

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