|
|
|
|
|
by onetimeuse92304
722 days ago
|
|
How is this unfortunate? Most programmers learn about loops pretty much at the absolute start of their development experience, where they don't yet have a way to talk about recursion. Don't even start about tail recursion or tail recursion optimisation. |
|
I'd like to know how its unfortunate as well, I'm not sure I agree with this though.
The programmer will have learnt that programs have a beginning and an end, they will have some notion of a variable, its type, and manipulating their values. They will even likely have learnt conditional branching logic. The only new concept here is that of jumping areas of code.If you next introduce methods you can clean it up and illustrate it more cleanly:
Finally you can explain the programmer "hey, there's this shortcut we can take called a loop that expresses this more succinctly": Nice simple-looking code. Yet this concept requires being able to grok much more than the relatively simple tail-recursive definition.