News for hackers. Stuff that matters.
Re:Reconsidering the way I explain programming (2020) by sdedovic on Tuesday July 27, 2021 @10:51PM (#27979818)
I find recursion can be just as simple to explain.

Start with a basket of tomatoes and a bowl. If there are no tomatoes in the basket, you’re done. Otherwise: Take one tomato. Dice it. Put the output in the bowl. Recur.

Re:Reconsidering the way I explain programming (2020) by allturtles on Tuesday July 27, 2021 @11:15PM (#27979901)
Have you actually explained it to people that way and had them get it? I think most people would just understand what you described as an iterative process, and understand recur as being no different than repeat.
Re:Reconsidering the way I explain programming (2020) by zozbot234 on Wednesday July 28, 2021 @06:57AM (#27982388)
Iteration (repetition) is a special case of recursion where the recursive action is always the final step in the process; it's a kind of recursion that dispenses with the need to track a stack of process activations. So it's quite possible to teach both in the same context.
Re:Reconsidering the way I explain programming (2020) by mimixco on Wednesday July 28, 2021 @12:45AM (#27980324)
Indeed. Recursion requires that a procedure calls (or recurses over) itself.
Re:Reconsidering the way I explain programming (2020) by mimixco on Wednesday July 28, 2021 @06:45PM (#27990730)
Re:Reconsidering the way I explain programming (2020) by zug_zug on Wednesday July 28, 2021 @01:52AM (#27980608)
I'm meh on that example (hard to say it's not a while loop), but I agree that humans already understand and execute recursion in their day-to-day life, so it is a communication thing.

How about this example as an example of recursion: Looking up a word in a dictionary (a real-life binary search).