Creating Higher-Order Functions for Lists

Learn how to create higher-order functions for lists.

Using functions in variables, like with any other value, can be hard to remember for newcomers. To practice, we’ll work with a subject familiar to us: lists. They’re a useful data type and are present in almost any program we need to build. We’ve seen how to work with them using recursive functions, but if we stop and look again at all that code we’ve written, we’ll see that they are a little repetitive and boring. We always have code that navigates through each item and stops when the list is empty. Now, we’ll look at building higher-order functions that hide the tedious tasks and provide an interface for what matters. Let’s start with the navigation routine.

Navigating through items of a list

Get hands-on with 1400+ tech skills courses.