Skip to content

Instantly share code, notes, and snippets.

@luhenry
Created May 12, 2014 23:05
Show Gist options
  • Save luhenry/9b8377c5dfa3ceac1d66 to your computer and use it in GitHub Desktop.
Save luhenry/9b8377c5dfa3ceac1d66 to your computer and use it in GitHub Desktop.
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