Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Anonymous-recursion/D/anonymous-recursion-1.d
Normal file
14
Task/Anonymous-recursion/D/anonymous-recursion-1.d
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue