News for hackers. Stuff that matters.
Re:Why is learning functional programming so damned hard? (2... by toast0 on Monday August 16, 2021 @03:17AM (#28195700)
Too late to edit, but if you do

fib(N) when ... -> fib(N - 2, fib(0) + fib(1), fib(1)).

Then you can check for N = 0 to return Current, and do N - 1 in the iteration. One less value to pass in each recursion should make it faster, and it's less to think about.

There are no comments on this comment yet.