Your programming roadmap

Functional Abstraction and Functional Programming

higher-order functions, composition, lambda expressions, closure, map, reduce, recursive functions

Function abstraction helps make our code more readable, flexible, and reusable.

Consider using the apply first, study second approach with the resources below: try a problem or exercise from the Apply It section first. If you get stuck, then use a course, book, or lecture in the Reference section. Or if you’re completely new to a topic, then learn just enough and apply right away. The point is: the quicker you get to the “doing,” the better the learning. Make your learning active.

Apply It

There’s a lot to cover in this topic. So I’ll break it down by these three sub-sections:

Higher-Order Functions and Lambda Expressions

Berkeley’s course, CS 61A: Structure and Interpretation of Computer Programs, offers several great problem sets on higher-order functions, as well as a project to help you nail core concepts. If time allows, I recommend that you do them all. These are quality problems, with tests, and they’re free. I’ll order the problem sets from easier to harder.

First, start with Disc 02: Higher-Order Functions. Copy the question prompts into your text editor and start solving. I really like this problem set: the problem statements are clear and are well-selected to test your knowledge of higher-order functions. The short summaries on higher-order functions, lambdas, and the like are also a useful refresher.

Tip: Here’s a way to stay sharp with previously learned topics as you learn new ones: complete a daily spot drill.

For example, say you complete this section of the Pyramid, Functional Abstraction and Functional Programming, and you move on to Databases. Pick a problem from one of the problem sets listed here and re-solve it before diving into your database work for the day. The idea is to keep yourself fresh on previously learned topics as you learn new ones.

Tackle Lab 2: Higher-Order Functions, Lambda Expressions next. This lab contains many great problems (with tests) to get practice with higher-order functions and lambda expressions. This short video will show you how to access the files and run the tests for Lab 2.

Now put your knowledge of functions to the test with this project: Project 1: The Game of Hog. It’s a fun project and you’ll learn a lot. This short video will show you how to access the files and run the tests for Project 1.

Map, Reduce, Composition, and Closure

The exercises associated with Will Sentance’s course, The Hard Parts of Functional JavaScript on FrontEnd Masters offer targeted practice with map, reduce, and function composition. As I explain below in the “Reference” section, Sentence is an excellent teacher, so this is a solid course content-wise.

But, for our purposes right now, it’s equally useful for the problems it provides. There are 15 problems for higher-order functions, 12 for closure, and 6 “extension challenges.” The point is, you’ll get plenty of targeted practice on these functional concepts. I’d do as many as you can.

Note: Find the exercises under the header “Resources and Downloads” once you’ve accessed the course.

"The secret of getting ahead is getting started. The secret of getting started is breaking your complex overwhelming tasks into small manageable tasks, and starting on the first one."

-Mark Twain


There are several free online resources to get practice with recursion. First, check out Disc 03: Recursion from Berkeley's CS 61A course. Copy the question prompts into your text editor and start solving.

Next, check out Exercism. Sign up for an account and select a language track. Then, filter the problems by topic and select “Recursion” to get the recursive problems. A reason why I like Exercism is because it offers community solutions to learn from once you’ve solved a problem.

Tip: One of the best ways to learn recursion is to learn Scheme. This is because everything is recursive in Scheme—there are no loops. Simply Scheme by Brian Harvey and Matthew Wright is a useful book to help you learn and get practice with this language. One of my favorite Scheme books is The Little Schemer. I like it not only for its content but also its teaching style.


The resources below will be organized in these sub-topics:

Higher-Order Functions and Lambda Expressions

There are several free lectures from the Berkeley course CS 61A course that may be useful as you work through this particular section of the Pyramid:

Solidify your understanding of higher-order functions with these two courses on FrontEnd Masters by Will Sentance:

Sentance is a great teacher. He differentiates himself by his teaching approach: he makes learning visual by diagraming everything. You see what happens under the hood—line by line—when you call a function, for example. You see him add a frame to the call stack and pop it off when it returns. As a result, he makes the abstract concrete.

I realize the course is in JavaScript, and please don’t let that deter you. It’s not the language; it’s the concepts, and Sentance does a really nice job explaining higher-order functions here as well as tackling the concepts below in a very clear and visual way.

Map, Reduce, Composition, Closure

There are two courses on FrontEnd Masters by Will Sentance that I recommend to better learn and understand map, reduce, composition, and closure:

I recommend these courses once more for the same reasons discussed above in the Higher-Order Functions section.


I really like the recursion explanation found in Aditya Bhargava’s book, Grokking Algorithms, which I reference throughout the Pyramid. The book is concept-oriented: instead of a bunch of recursive problems to solve, Bhargava focuses on the main concepts of recursion (as well as algorithms and data structures) and illustrates them with pictures. I find this approach useful, particularly when trying to wrap my head around abstract things. This book is a great place to start if you’re new to recursion (see chapter 3).

You may find this free lecture series from the Berkeley course CS 61A course useful: Recursion. However, this lecture in particular does a really nice job explaining recursion.

If you implement my tip from the Apply It section and decide to learn Scheme (and I highly recommend that you do), then you’ll find Hal Abelson’s book, Structure and Interpretation of Computer Programs useful and it’s freely available online. Reference chapter 1 for both it’s content and exercises.

← Back to Programmer's Pyramid