Higher-Order Function
A higher-order function takes functions as arguments or returns a function — the core abstraction of functional programming, enabling map/filter/reduce and more.
Purpose
Express complex logic through function composition, raising the level of abstraction and reuse.
Mechanism
map(f, list): applies f to each element. filter(pred, list): keeps elements satisfying pred. reduce(f, init, list): accumulates and merges. curry(f): turns a multi-argument function into a chain of single-argument ones.
Use cases
- Functional programming
- Collection operations
- Function composition