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,14 @@
int fib(in uint arg) pure nothrow @safe @nogc {
assert(arg >= 0);
return function uint(in uint n) pure nothrow @safe @nogc {
static immutable self = &__traits(parent, {});
return (n < 2) ? n : self(n - 1) + self(n - 2);
}(arg);
}
void main() {
import std.stdio;
39.fib.writeln;
}

View file

@ -0,0 +1,18 @@
import std.stdio;
int fib(in int n) pure nothrow {
assert(n >= 0);
return (new class {
static int opCall(in int m) pure nothrow {
if (m < 2)
return m;
else
return opCall(m - 1) + opCall(m - 2);
}
})(n);
}
void main() {
writeln(fib(39));
}