Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
void main() {
import std.stdio, std.math, std.typetuple, std.functional;
alias dir = TypeTuple!(sin, cos, x => x ^^ 3);
alias inv = TypeTuple!(asin, acos, cbrt);
// foreach (f, g; staticZip!(dir, inv))
foreach (immutable i, f; dir)
writefln("%6.3f", compose!(f, inv[i])(0.5));
}

View file

@ -0,0 +1,18 @@
void main() {
import std.stdio, std.math, std.range;
static T delegate(S) compose(T, U, S)(in T function(in U) f,
in U function(in S) g) {
return s => f(g(s));
}
immutable sin = (in real x) pure nothrow => x.sin,
asin = (in real x) pure nothrow => x.asin,
cos = (in real x) pure nothrow => x.cos,
acos = (in real x) pure nothrow => x.acos,
cube = (in real x) pure nothrow => x ^^ 3,
cbrt = (in real x) /*pure*/ nothrow => x.cbrt;
foreach (f, g; [sin, cos, cube].zip([asin, acos, cbrt]))
writefln("%6.3f", compose(f, g)(0.5));
}