2 ms·
This might be the root of the problem for the author: >>> In principle, natural numbers are also recursive data: a number is either zero or the successor of an
by analog31 4y ago
This might be the root of the problem for the author:
>>> In principle, natural numbers are also recursive data: a number is either zero or the successor of another natural number. However, this way of thinking is not natural to students...
That's because students didn't learn math. "Back in my day," we learned mathematical induction sometime in middle school, and were re-introduced to it from time to time as a style of proof. When I finally got a chance to learn programming (in 1981), recursion was taught as something we already knew, being related to induction.
- TheOtherHobbes 4y agoWhich is closer to how it should be taught. The factorial example is trivial and too familiar. It's easy for students to think "Oh, I know that" when in fact they don't get it at all. Recursive operations on data structures are more likely to be unfamiliar. And you need something unfamiliar to demonstrate the point and also illustrate how it's likely to be used in practice.
- lupire 4y agoInduction isn't recursion. Induction is why recursion works. Unless you are assuming ZFC, which is much more comlplex then recursion itself, in second-order logic Induction is an axiom that we use to avoid recursion, by setting up the recursive step and then saying "so we don't have to execute it and look further" Constructing the naturals is dynamic programming (building up), not recursion (breaking down). Calculatiny addition using Peano axioms, that is recursion.
- analog31 4y agoWe hadn't gotten to those kinds of concepts in school by the time I learned recursion. The math that confounds programmers is much more basic.
- DeathArrow 4y agoMost of the time a sequence of numbers is recursively defined. Ex. Xn = Xn-1 + 2n So a student might be familiar with it.