Higher-order function
A higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
The Joy of JavaScript
A higher-order function is a function that takes one or more functions as arguments and/or returns a function as its result.
- How it is used
- Uses higher-order functions to separate application logic from array traversal, compose behavior, and supply logic to observable operators.
- How deep it goes
- Defines the function-passing pattern and works through array callbacks, returned closures, and validation wrappers; leaves richer validation to data types.
- Examples
- Shows block validation with filter, map, and reduce; returns an object-processing function from assemble; wraps functions with a null check.
- What you can do after
- Build it from scratch by returning functions that retain inputs, and apply it via array methods to compose smaller operations.
Read how The Joy of JavaScript explains higher-order function →
Grokking Simplicity
A function that accepts functions as arguments, returns functions as results, or otherwise treats functions as values.
- How it is used
- Abstracts over varying behavior to replace repeated loops, error-handling contexts, data updates, and other manual coding disciplines.
- How deep it goes
- Defines callbacks, derives functions through refactoring, and demonstrates returned functions, while noting readability tradeoffs without exploring language internals.
- Examples
- Uses forEach(), map(), filter(), reduce(), withLogging(), wrapLogging(), makeAdder(), update(), and array-loop refactorings.
- What you can do after
- Apply it via JavaScript by extracting callbacks, building reusable contexts, composing array operations, and returning specialized functions.
Read how Grokking Simplicity explains higher-order function →
F# in Action: A Revised Edition of Get Programming with F#
A higher-order function is a function that takes functions as arguments, returns a function, or both.
- How it is used
- Uses function arguments to vary logging, collection transformations, and side effects without duplicating the surrounding operation.
- How deep it goes
- Works through inferred function-argument types and signatures, then examines testing and purity limits; does not require interfaces.
- Examples
- Uses a calculator with replaceable logging and an invoice tested with a fake database-save function.
- What you can do after
- Build it from scratch by accepting a function argument, then supply real or fake behavior at the call site.
Read how F# in Action: A Revised Edition of Get Programming with F# explains higher-order function →
Tiny Python Projects: Learn coding and testing with puzzles and games
A higher-order function is a function that accepts another function as an argument or returns a function.
- How it is used
- Deploys map() and filter() to transform or select iterable elements while comparing them with list comprehensions.
- How deep it goes
- Explains function arguments, lambdas, laziness, and truthiness through runnable examples, but does not examine implementation internals.
- Examples
- Uses vowel replacement, number squaring, blue-car selection, and consonant extraction as concrete transformations and filters.
- What you can do after
- Apply it via Python's map() and filter() with named functions or lambdas, then materialize lazy results with list().
Functional Programming in C#, Second Edition
A higher-order function is a function that takes one or more functions as arguments or returns a function as its result.
- How it is used
- Uses higher-order functions to separate reusable control flow from variable behavior and reduce duplication.
- How deep it goes
- Defines both forms and works through filtering, function factories, and resource-management helpers; defers asynchronous database I/O.
- Examples
- Uses divisibility predicates, cache misses, database connection management, and a clock-dependent validator.
- What you can do after
- Apply higher-order functions in C# to customize filtering, factor out connection management, and supply testable dependencies.
Read how Functional Programming in C#, Second Edition explains higher-order function →
Functional Programming in Scala, Second Edition
A higher-order function is a function that takes one or more functions as arguments or returns a function as its result.
- How it is used
- Uses function values to remove duplicated logic and compose pure functional programs.
- How deep it goes
- Explains arguments, anonymous functions, polymorphism, partial application, currying, uncurrying, and composition, but not advanced library abstractions.
- Examples
- Demonstrates formatResult, anonymous predicates, isSorted comparisons, partial1, curry, uncurry, and composed trigonometric functions.
- What you can do after
- Builds reusable Scala functions, passes named or anonymous behavior, and derives implementations from polymorphic type signatures.
Read how Functional Programming in Scala, Second Edition explains higher-order function →
Functional Programming in JavaScript
A higher-order function is a function that takes other functions as arguments, returns a function, or both.
- How it is used
- Uses functions as configurable behavior for reusable processing, composition, and fluent data-processing chains.
- How deep it goes
- Explains passing and returning functions with JavaScript examples, then connects them to composition and chains without developing implementation internals.
- Examples
- Demonstrates sorting, operation application, returned functions, people filtering, enrollment averages, and reactive SSN validation.
- What you can do after
- Apply it in JavaScript to separate data traversal from behavior and assemble modular operations with functions such as filter and map.
Read how Functional Programming in JavaScript explains higher-order function →
Clojure: The Essential Reference
A higher-order function is a function that can be treated as a value by being stored, passed as an argument, or returned.
- How it is used
- Uses functions as values to defer arguments, adapt computations, and wrap repeated calls with caching.
- How deep it goes
- Defines function-as-value behavior and works through partial application and transparent caching; contrasts explicit partial with automatic currying.
- Examples
- Demonstrates partial request validation and memoized addition with visible cache misses.
- What you can do after
- Apply it via Clojure’s partial and memoize to adapt functions and cache repeat calls without changing the originals.
Read how Clojure: The Essential Reference explains higher-order function →
Python How-To
A higher-order function is a function that accepts functions as arguments, returns functions, or both.
- How it is used
- Uses functions as values to transform iterables, create specialized functions, and build decorators.
- How deep it goes
- Explains both argument and return patterns with runnable examples, revisits map as a class, and notes closures without formally introducing them.
- Examples
- Uses numeric-string conversion, an increment-function factory, and an application-prefixed timing decorator challenge.
- What you can do after
- Builds simple function factories and applies function arguments to iterable transformations.
Kotlin in Action, 2E
A higher-order function is a function that accepts functions as arguments, returns functions, or both.
- How it is used
- Extracts variable behavior into lambdas or function references to remove duplication and structure Kotlin code.
- How deep it goes
- Defines argument- and return-based forms, implements custom filters, and relates performance and return-control details to inline and anonymous functions.
- Examples
- Demonstrates arithmetic operations, string filtering, shipping calculators, contact predicates, and site-visit duration analysis.
- What you can do after
- Build it from scratch by declaring function-typed parameters or returns and supplying behavior as lambdas.
Read how Kotlin in Action, 2E explains higher-order function →
Acing the Frontend Interview
A higher-order function is a function that accepts another function as an argument, returns a function, or does both.
- How it is used
- Frames higher-order functions as a practical functional-programming technique for cleaner, predictable, and modular JavaScript.
- How deep it goes
- Defines the feature, demonstrates currying and wrappers, and applies it to pipelines and React hooks without detailing implementation internals.
- Examples
- Uses map transformations, curried multiplication, logging wrappers, data-processing pipelines, and a React useInterval timer.
- What you can do after
- Apply it via JavaScript array methods, function wrappers, data pipelines, and React custom hooks.
Read how Acing the Frontend Interview explains higher-order function →
Julia as a Second Language
A higher-order function is a function that takes one or more functions as arguments, returns a function, or both.
- How it is used
- Uses collection operations to introduce functional programming and contrasts function-based design with object-oriented design.
- How deep it goes
- Defines higher-order functions and builds a simple map implementation, then combines mapping, filtering, and reduction in worked examples.
- Examples
- Uses degree conversion, pizza-sales totals, and a sine approximation with a nested Taylor-term function.
- What you can do after
- Apply it via Julia’s map, filter, and mapreduce to transform, select, and aggregate collections.
Read how Julia as a Second Language explains higher-order function →
The Well-Grounded Rubyist, Fourth Edition
A higher-order function is a function that takes another function as an argument or returns a function as its result.
- How it is used
- Uses functions as values to transform collections, delay computation, specialize arguments, and compose concise functional programs.
- How deep it goes
- Explains block arguments, returned procs, currying, partial application, calling forms, arity, and lazy higher-order computations.
- Examples
- Demonstrates map, multiplier procs, curried multiple-finding functions, addition, lazy squares, and recursive sums of powers.
- What you can do after
- Build it from scratch by passing blocks, returning procs, and using currying to create reusable functions with delayed arguments.
Read how The Well-Grounded Rubyist, Fourth Edition explains higher-order function →
Elixir in Action, Third Edition
A higher-order function is a function that accepts one or more functions as arguments, returns one or more functions, or both.
- How it is used
- Uses function values to express iteration, transformation, filtering, and accumulation without writing recursive loops.
- How deep it goes
- Defines the mechanism and works through Enum examples, but defers enumerable contracts and broader lazy iteration details.
- Examples
- Demonstrates printing, doubling, filtering odd numbers, reporting missing fields, summing values, and ignoring nonnumeric elements.
- What you can do after
- Apply via Enum functions to iterate, transform, filter, and reduce enumerable data with less recursive boilerplate.
Read how Elixir in Action, Third Edition explains higher-order function →
Learn Haskell by Example
A higher-order function is a function that receives one or more functions as arguments or returns a function as its result.
- How it is used
- Generalizes list transformations and selects program behavior by passing functions as values.
- How deep it goes
- Defines the abstraction, implements recursive list traversal, checks polymorphic types, and applies functions in a command-line tool.
- Examples
- Uses numeric increments, predicates, character replacement, line-numbering choices, and graph-function generalization.
- What you can do after
- Build reusable polymorphic list transformations and switch application behavior by selecting functions at runtime.
Read how Learn Haskell by Example explains higher-order function →
The Art of Code
A higher-order function is a function or method that accepts functions as arguments, returns a function, or both.
- How it is used
- Uses function-valued arguments to build readable, composable stream transformations.
- How deep it goes
- Defines the concept and demonstrates map, filter, chaining, method references, and lazy evaluation without deeper function-runtime internals.
- Examples
- Demonstrates recent-book filtering, author extraction, method references, chained streams, and collection with toList().
- What you can do after
- Apply it via Java streams to express filtering and transformation pipelines as readable, lazy stages.
Type-Driven Development with Idris
A higher-order function is a function that accepts another function as an argument or returns a function as its result.
- How it is used
- Uses higher-order functions to capture repeated programming patterns and write more generic programs.
- How deep it goes
- Defines function-taking types, works through implementations and REPL examples, and defers the details of map's Functor constraint.
- Examples
- Demonstrates twice with quadruple and rotation, then uses map for word lengths and filter for numbers above 10.
- What you can do after
- Apply higher-order functions to reuse operations and transform or filter lists.
Read how Type-Driven Development with Idris explains higher-order function →
Also covered in
- Idiomatic Rust
- Go by Example
- Rust in Action: Systems programming concepts and techniques
- Building User-Friendly DSLs
- Fabulous Adventures in Data Structures and Algorithms
- Functional Design and Architecture: Examples in Haskell
- Python Workout: 50 ten-minute exercises
- Python Workout, Second Edition
- The Art of Unit Testing 3e
- Vanilla WebIn early access (MEAP)
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- functional programmingFunctional programming is a programming paradigm that expresses computation through the evaluation and composition of functions, typically favoring immutable data and minimizing mutable state and side effects.
- lambdaA lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
- filteringFiltering is the selection or exclusion of data or items according to specified criteria.
Related concepts
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- reduction operationincludes · A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate.
- curryingcontrasts with · Currying is the transformation of a function that accepts multiple arguments into a sequence of functions that accept arguments incrementally, typically one at a time.
- lambdauses · A lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
- map!includes · map! is a mutating collection operation that applies a transformation to elements and writes the resulting values into a destination collection.
Questions about higher-order function
What is higher-order function?
A higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
Which Manning books explain higher-order function?
The Joy of JavaScript, Grokking Simplicity, F# in Action: A Revised Edition of Get Programming with F#, Tiny Python Projects: Learn coding and testing with puzzles and games, Functional Programming in C#, Second Edition, Functional Programming in Scala, Second Edition, Functional Programming in JavaScript, Clojure: The Essential Reference and 9 more.
What should I know before learning higher-order function?
Manning books that teach higher-order function usually introduce function, functional programming, lambda and filtering first.
What is the difference between higher-order function and currying?
A higher-order function is a function that accepts functions as arguments, returns functions as results, or both. Currying is the transformation of a function that accepts multiple arguments into a sequence of functions that accept arguments incrementally, typically one at a time.
What kinds of higher-order function are there?
Kinds of higher-order function include reduction operation, map! and Enum.each/2.
What is higher-order function a kind of?
Higher-order function is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
















