News for hackers. Stuff that matters.
Re:Why is learning functional programming so damned hard? (2... by Twisol on Sunday August 15, 2021 @06:18PM (#28193060)
For completeness, what was your solution? I promise not to judge it if you don't want me to :) but it seems like it would be a valuable discussion for others who might be on the fence.

My solution (from another conversation on this very page) is:

    fib 0 a b = b
    fib n a b = fib (n - 1) b (a + b)
It might (or might not) look simple, but this solution arises from an understanding of computation as reduction, which is very much not how imperative languages go about things. So it's really not shameful or even problematic to have arrived at a different solution first.
Re:Why is learning functional programming so damned hard? (2... by GnarfGnarf on Friday August 20, 2021 @10:05AM (#28246115)
I don't recall, it was probably the naïve one.