You have "n+1", so it's calling fib 3, fib 4, fib 5, ... forever

By on 1/17/2011 4:44 PM ()

Doh!

Sure enough just type in the right function and it works. I must have made the same mistake several times.

1
2
3
4
5
let rec fib n = 
	match n with 
	| 0 -> 0 
	| 1 -> 1 
	| _ -> fib (n - 1) + fib (n - 2);;
By on 1/17/2011 5:14 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper