Chapter 4. Hello Recursion!

In this chapter, we’ll take a look at recursion. We’ll learn why it’s important in Haskell programming and how we can find very concise and elegant solutions to problems by thinking recursively.

Recursion is a way of defining functions in which a function is applied inside its own definition. In other words, the function calls itself. If you still don’t know what recursion is, read this sentence. (Haha! Just kidding!)

image with no caption

Kidding aside, the strategy of a recursively defined function is to break down the problem at hand into smaller problems of the same kind and then try to solve those subproblems, breaking them down further ...

Get Learn You a Haskell for Great Good! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.