Live data from Hacker News

Understanding Recursion as an Absolute Beginner

bigomega.dev

1–10 of 55 posts

Re: Understanding Recursion as an Absolute Beginner

#3
How "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

#4
A better resource is How To Design Programs. A better title for it would be "How to design recursive algorithms using Scheme".

https://htdp.org/

Every 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

#6
Recursion is absolutely easier to understand, period. A big reason for using it is that it's easier to convince ourselves that a recursive solution is correct; it directly gives us the pieces that we need for inductive reasoning. The degree to which a module of code is hard to understand is directly related to the effort required to convince ourselves that it does exactly what it is supposed to, in all cases.

Recursive 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

#7
I like the dark movie theater analogy for beginners e.g. in a dark theater, how would you know what row you're sitting in? You'd ask the row in front of you "what row are you in?" and they'd shake their head and ask the row in front of them and so on until they finally get to the first row, who would know they're in the first row, and at which point they can answer the second row's question all the way back to the row that originally asked the question.

Re: Understanding Recursion as an Absolute Beginner

#8

How "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.

Recursion is not something you do very often, so it might just be a matter of having a "aha moment" where you finally get it.

Re: Understanding Recursion as an Absolute Beginner

#9
>Most of the people find recursion difficult but it's not.

Recursion 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.

Post reply on HN