Conquering Recursion

For many developers, recursive functions are one of the hardest things to understand when moving to functional programming. Finding the stop-condition clause and making the function call itself can be confusing. Functional programmers work more with recursive functions than developers in other paradigms, because recursive functions are the core of code repetition. If you want to become a functional programmer, it’s important that you don’t get stuck every time you face a recursive function.

There are two helpful techniques for solving problems using recursive functions: decrease and conquer and divide and conquer. We’ll explore them next.

Decrease and Conquer

Decrease and conquer is a technique for reducing a problem to its ...

Get Learn Functional Programming with Elixir now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.