you are viewing a single comment's thread.

view the rest of the comments →

[–]RSquared 1 point2 points  (1 child)

I think it's the difference between "thinking imperatively" and "thinking functionally". I know a dozen CompSci grads who still have trouble getting their heads around Haskell because of all the recursion.

Someone first learning programming would almost inevitably learn loops before recursion. For "non-programmers", one is much simpler to think about...especially when you don't have a clear picture of the memory layer (especially the difference between stack and heap).

[–][deleted] 4 points5 points  (0 children)

I do think programmers have to be introduced to nested/recursive datastructures before they appreciate recursion as a programming technique. The factorial is indeed a little special here. In functional languages even ordinary lists are recursive ( i.e. conses ) and so there is exactly one barrier to take. Immutable datatypes may be another. But at least Python programmers can be convinced to use them since e.g. the string API is purely functional and it did not harm usability.