Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,14 +1,14 @@
|
|||
import std.stdio, std.exception;
|
||||
int fib(in uint arg) pure nothrow @safe @nogc {
|
||||
assert(arg >= 0);
|
||||
|
||||
int fib(int arg) pure {
|
||||
enforce(arg >= 0);
|
||||
|
||||
return function int (int n) pure nothrow {
|
||||
auto self = __traits(parent, {});
|
||||
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