Timeline for Analogy for teaching recursion
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 11, 2018 at 2:17 | comment | added | Criticizing Israel not allowed | The first one is just a loop... | |
May 23, 2017 at 21:53 | history | edited | thesecretmaster♦ | CC BY-SA 3.0 |
added 802 characters in body
|
May 23, 2017 at 21:08 | comment | added | Andrew Sundstrom |
You've shown tail-recursion on a problem of the same size at each function invocation, and have thus merely reformulated a do {...} until block. This doesn't demonstrate the general power of recursion. To keep with your example, I prefer a formulation like this: function revise(essay) { if essay.scale > sentence { foreach s in essay.subsections { revise(s); } } do { read(essay); get_feedback_on(essay); apply_changes_to(essay); } until essay.complete? }
|
|
May 23, 2017 at 17:00 | vote | accept | pluke | ||
May 23, 2017 at 15:58 | history | answered | thesecretmaster♦ | CC BY-SA 3.0 |