Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think that's the case because the Fibonacci sequence isn't interesting as a sequence itself to most developers, but as an example of basic recursion. And as an example of basic recursion, you can have a base case be slightly off without misrepresenting what the essence is.


you're right, but you can implement the real fib by returning N instead of 1:

let rec fib n = if n < 2 then n else fib(n-1) + fib(n-2)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: