The line before the else statement apparently was expecting a unit but got a boolean instead. I'm just starting out with F# but can't fathom this one.
I'm fighting the layout a bit as I've never used Stackoverflow before and the code box is still confusing me! The spacing in the original is indented, I believe, correctly.
let m = Dictionary<int, int>()
let rec fib i =
match i with
| 1 -> i
| 0 -> i
| _ ->
if m.ContainsKey(i) then
if m.[i] > 0 then
m.[i]
else
let x = fib(i - 1) + fib(i - 2)
m.Add(i, x)
m.[i]
If anyone can tell me how to keep the spacing in these posts I'd be grateful!