Any tips on understanding recursion?

Trying to understand recursion in Elixir. Sometimes it is simple based on the problem, sometimes it is hard. Any suggestions on how to learn and understand it better?

5 Likes

Corresponding tweet for this thread:

Share link for this tweet.

1 Like

Check out PragProg ‘Learn Functional Programming with Elixir’ chapter on recursion. That might help.

4 Likes

I agree - I learnt some really cool things in that book!

#book-learn-functional-programming-with-elixir

Here’s my review of it:

The book’s author @ulissesalmeida is here on Devtalk too :+1:

4 Likes

There’s an awesome book that’s not about Elixir at all called The Little Schemer which is a fun and illuminating way to learn recursion and functional-ish stuff like linked lists. It’s written as a fun quiz that asks questions before you could know the answer, so that you have to guess about things before being exposed to them. Scheme is a lisp, but it actually shares a great deal with Elixir. I printed out a copy of the book that I found online and went though it like that, without touching a keyboard. You’ll quickly be doing recursion in your head and it will makes total sense and will be fun, and I think several parts of the structure of a language like Elixir will open up to you. At least it seemed to help me in that way.

3 Likes

Thank you for this suggestion.

3 Likes

Think I’ve heard that book mentioned before… so might just have to get it one day! :smiley:

3 Likes

Chapter 7 Lists and Recursion of Programming Elixir 1.6 was also good

3 Likes

:bulb: It is necessary to do exercises on this topic and constantly review your understanding. This principle is called from particular to general.


:mag_right: Become Sherlock Holmes, as Joe Armstrong recommended in his book [Programming Erlang (2nd edition)].
image

3 Likes