Lesson 9. Higher-order functions
After reading lesson 9, you’ll be able to
- Understand higher-order functions
- Use map, filter, and foldl to avoid writing explicitly recursive functions
- Implement many higher-order functions yourself
In the preceding lesson, you saw a wide variety of recursive functions. Although practice makes writing recursive code easier, many functions share the exact same patterns of recursion. Therefore, you can abstract out this recursion into a small number of commonly used functions that don’t require you to think about recursion explicitly. The practical answer to the challenge of writing recursive code is that you usually use these existing functions, which are part of a group of functions referred to as higher-order ...