O'Reilly logo

Get Programming with Haskell by Will Kurt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 8. Writing recursive functions

After reading lesson 8, you’ll be able to

  • See common patterns of applying rules of recursion
  • Understand how to use recursion on lists
  • Learn to time functions in GHCi
  • Reason about the edge cases of our five rules of recursion

The best way to get better at recursion is to practice, practice, practice! In this lesson, we’ll walk through a variety of recursive functions to help you apply the rules of recursion presented in the preceding lesson. As you do this, you’ll start to see that a few patterns repeat when solving recursive problems. Because Haskell doesn’t allow you to “cheat” by using stateful iteration, nearly all the code you write in Haskell will involve some recursion (though often this is abstracted ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required