-
-
Save luhenry/9b8377c5dfa3ceac1d66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
class Driver { | |
static Task<int> One () | |
{ | |
return Task<int>.Factory.StartNew (() => { return 1; }); | |
} | |
static async Task <int> Fib (int x) | |
{ | |
if (x <= 1) | |
return await One (); | |
else | |
return await Fib (x - 1) + await Fib (x - 2); | |
} | |
static void Main () { | |
var res = Fib (27); | |
Console.WriteLine (res.Result); | |
} | |
} | |
/* | |
To AOT: | |
From: mcs/class/lib/net_4_5 | |
MONO_PATH=. ~/src/mono/mono/mini/mono --aot mscorlib.dll | |
To decompile: | |
MONO_PATH=. monodis mscorlib.dll | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment