Understanding Recursion as an Absolute Beginner
bigomega.dev
Understanding Recursion as an Absolute Beginner
1–10 of 55 posts
Re: Understanding Recursion as an Absolute Beginner
#2 countDownFrom(--n)
There's no reason to reassign the decremented n within the function. Prefer: countDownFrom(n - 1)Re: Understanding Recursion as an Absolute Beginner
#3If recursion is difficult to grasp, I'm afraid it's not going to get any easier from there.
Re: Understanding Recursion as an Absolute Beginner
#4Every now and again, you need recursion. It doesn't come up too often, simple maps and the occasional reduce handle 95% of tasks. But every once in awhile simple iteration isn't good enough, and you'll be glad you'd gone through HtDP all those years back like I did.
Re: Understanding Recursion as an Absolute Beginner
#5Re: Understanding Recursion as an Absolute Beginner
#6Recursive solutions are hard to come up with for someone whose perspective is biased due to having a background in writing imperative code with iteration. They have already forgotten the difficulties they overcame in acquiring their existing skills.
Someone who learned nothing but recursion (and pure functional programming) will likely struggle with loops, gotos and assignments.
Re: Understanding Recursion as an Absolute Beginner
#7Re: Understanding Recursion as an Absolute Beginner
#8How "absolute beginner" are we talking here? At what point have we distilled a concept to its bare minimum and failure to understand simply requires the person to spend more time with the concept? If recursion is difficult to grasp, I'm afraid it's not going to get any easier from there.
Re: Understanding Recursion as an Absolute Beginner
#9Recursion is really hard.
According to
https://phys.org/news/2019-08-recursive-language-modern-simu...
Recursive language is a relatively recent phenomenon and even now is much harder to acquire than language and grammar. Recursion is probably the biggest thing that separates our communication from that of other species and gives such a big advantage.
That being said, if you are reading HN, you have already mastered a recursive human language. You have the ability to understand recursion. Just be aware that it is one of the more complicated things your brain does, and be patient with yourself. Keep working at it, and eventually you will get it. Don't become discouraged by the process and give up.