I get a lot of questions about recursion. For a lot of us, it's not something we've ever been taught or had to learn. But in functional programming, recursion is used quite a lot. It's not that different from iteration, and sometimes can be much easier to write, once you learn to see what's going on.

In this introductory course, I'm going to show how to write recursive functions, along with explaining the basic concepts, the 2 types of recursion, and the 3 parts of all recursions.

Want this course?

Team License

$200
  • HD Download
  • Watch Online
  • Lifetime Access
  • For your company

Download License

$24
  • HD Download
  • Watch Online
  • Lifetime Access
  • For an individual

Online License

$18
  • Watch Online
  • Lifetime Access
  • For an individual

Membership

$49/mo
  • HD Downloads
  • Watch Online
  • Full access
  • All Content
  • For an individual
Get access

Love it or leave it guarantee

If you don't learn as much from this course as you thought, just ask for a refund within 30 days and I'll give you your money back.

Recursion 101

Lessons

Video time: 45m06s

length
  • 6 min
  • free

In the first lesson in Recursion 101, we jump right into defining a function that we use all the time but might not think of as recursive: length, which calculates the length of a list. This lesson includes a video screencast and some code. The lesson is 6 minutes long.

map
  • 4 min

In the second lesson in Recursion 101, we define another recursive function, map. This lesson includes a video screencast and some code. This lesson includes a video screencast and some code.

filter
  • 3 min

In the third lesson in Recursion 101, we define another common recursive function, filter. This lesson includes a video screencast and some code. The lesson is 3 minutes long.

The Two Types of Recursion
  • 5 min

In the fourth lesson in Recursion 101, we use filter as a good example of the two different kinds of recursion. This lesson includes a video screencast. The lesson is 5 minutes long.

filter with tail recursion
  • 8 min

In the fifth lesson in Recursion 101, we rewrite filter to be tail recursive. This lesson includes a video screencast and some code. The lesson is 8 minutes long.

map with tail recursion
  • 3 min

In the sixth lesson in Recursion 101, we rewrite map to be tail recursive. This lesson includes a video screencast and some code. The lesson is 3 minutes long.

length with tail recursion
  • 3 min

In the seventh lesson in Recursion 101, we rewrite length to be tail recursive. This lesson includes a video screencast and some code. The lesson is 3 minutes long.

How is Recursion like a for loop?
  • 5 min

In the eighth lesson in Recursion 101, we look back on the three parts of all recursions and compare it to the elements of a for loop. This lesson includes a video screencast. The lesson is 5 minutes long.

Recursion and laziness
  • 3 min

In the ninth lesson in Recursion 101, we rewrite map and filter to be lazy. This lesson includes a video screencast and some code. The lesson is 3 minutes long.

loop/recur
  • 5 min

In the tenth lesson in Recursion 101, we rewrite the tail-recursive forms of map and filter to use loop/recur. This lesson includes a video screencast and some code. The lesson is 6 minutes long.