Learn the most powerful functional tool
Reduce is the most powerful functional tool available. Whenever I write a recursive function, I ask myself whether it couldn't be better using reduce instead.
It lets you build general-purpose recursive solutions without doing the recursion explicitly yourself. In this course, we implement reduce and other functions like map and filter using it. This course also goes over some practical things you can do with reduce.
Before going through this course, you may want to familiarize yourself with recursion. You can watch my Recursion 101 course.
Want this course?
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.
1. Implementing reduce
In this lesson, we begin our exploration of the profound awesomeness of
reduce. We begin by implementing
2. Implementing map using reduce
It is entirely possible to implement map using reduce. We do that in this lesson.
There's a special version of reduce in Clojure for associative data structures like vectors and hashmaps.
Sometimes you want to have each of the steps of reduce laid out in a lazy sequence. It's great for debugging what's happening at every step, but also has certain applications to reductions over infinite sequences.
6. Average using reduce
Like we said before, reduce is kind of a universal recursion over lists. We can implement a function to calculate the average using reduce.