To think about recursion, you first have to think about recursion.
Thinking About Recursion
11–20 of 42 posts
Re: Thinking About Recursion
#12One of my favorite ways of thinking about recursion (and proofs by induction) is the recursion goblins. When you're writing a recursive function, you don't worry about how you got your input. The recursion goblins took care of that. You also don't need to worry about what will happen to the thing that you return . The recursion goblins will take care of that, too. All you need to worry about is what's happening in be…
Re: Thinking About Recursion
#13I always thought recursion was very elegant, but until now I was using it to scan through folders on the file-system and that was about it. Then I had an interesting problem at work where recursion seemed the most elegant solution ... but I quickly encountered errors that were not caught in a try catch block and made the program fail silently. I'll admit my ignorance, but I thought a stackoverflow was a "feature" of…
You really need language support to make recursion the best practical solution for most problems. However, even when working in "normal" languages like C#, I find that recursion has utility in designing solutions--it is often easiest to find a provably-correct solution for an inherently recursive problem by actually designing a recursive algorithm; you merely then have to perform some compiler work yourself to transf…
Re: Thinking About Recursion
#14Re: Thinking About Recursion
#15Re: Thinking About Recursion
#16The only recursion that still bothers me is Clownsort / Stooge sort [0]. That such an algorithm would work is still not my gut feeling.
Re: Thinking About Recursion
#17I like thinking about variables as boxes with labels. Hadn’t heard that before, but seems like a simple way to teach people. I skimmed the description of recursion. Seemed a bit long for my taste. I was taught how to write a recursive function like this: “Write the function signature, the docstring, and the base case. Then assume the function already works, and use it to implement the rest of the code”
Re: Thinking About Recursion
#18Re: Thinking About Recursion
#19One of my favorite ways of thinking about recursion (and proofs by induction) is the recursion goblins. When you're writing a recursive function, you don't worry about how you got your input. The recursion goblins took care of that. You also don't need to worry about what will happen to the thing that you return . The recursion goblins will take care of that, too. All you need to worry about is what's happening in be…
The Refactoring people knew this, and the Mikado method is essentially a way to find the 'bottom' when all you can see is the top of the rabbit hole, so you can use these other skills.