Higher-Order Functions on Lists I: Map and Filter

Check out map and filter - two higher-order functions commonly used on lists.

In the previous lessons, we learned how to write recursive functions on lists. There are a few recursion patterns that occur again and again. They can be abstracted in higher-order functions on lists. This allows us to write expressive list functions without worrying too much about implementing explicit recursion.

Map

The first recursion pattern we will look at is transforming list elements. For example, we might want to round each double in a list to its nearest integer.

Get hands-on with 1400+ tech skills courses.