liveBook · Manning

Reduction operation

A reduction operation combines multiple input values or partial results according to a combining rule to produce fewer results, often a single aggregate.

How 9 Manning books explain it

Clojure: The Essential Reference

reduce is a Clojure function that combines collection elements by repeatedly applying a reducing function to an accumulator and the next element.

How it is used
Uses reduction to finish collection-processing pipelines and accumulate results such as sums or word counts.
How deep it goes
Explains arities, accumulator updates, empty-input behavior, intermediate results, early termination, and memory pitfalls, then relates the contract to parallel folding.
Examples
Works through sums of squares, intermediate totals, word counts, running averages, and string concatenation benchmarks.
What you can do after
Build it from scratch with a two-argument reducing function and an appropriate initial accumulator; choose reductions when intermediate results are needed.

Read how Clojure: The Essential Reference explains reduction operation →

React Quickly, Second Edition

A reducer is a function that calculates a next state from a current state and an action or event.

How it is used
Organizes complex React state updates around dispatched actions, particularly when state values depend on one another.
How deep it goes
Works through counter and loader reducers, then extends the pattern through timer and task-manager exercises without requiring it for simple state.
Examples
Uses increment and decrement buttons, a data loader, timer reset, and task-step editing and prioritization.
What you can do after
Build it from scratch with useReducer and dispatch, then apply actions to coordinated UI updates without mutating existing arrays.

Read how React Quickly, Second Edition explains reduction operation →

Build a Frontend Web Framework (From Scratch)

A reduce function is a function conceptually applied to accumulated input to produce a result, providing the name's functional-programming origin for reducers.

How it is used
Derives application state after dispatched user commands so the view can be updated.
How deep it goes
Defines the state-and-payload contract and implements reducer wiring, while deferring more efficient rendering.
Examples
Uses to-do removal and a fuller set of to-do editing actions, plus a tic-tac-toe design exercise.
What you can do after
Build it from scratch: write pure reducers and connect them to dispatched commands in a small application framework.

Read how Build a Frontend Web Framework (From Scratch) explains reduction operation →

Advanced Algorithms and Data Structures

A reduce operation combines intermediate information from a homogeneous group of entries to produce a result.

How it is used
Uses reducers to combine grouped intermediate data into results in parallel computations.
How deep it goes
Defines reduction and illustrates counting, summing, filtering, and cluster-center calculation, without specifying a general reducer implementation.
Examples
Uses coin-occurrence counts and k-means cluster-center updates as concrete reductions.
What you can do after
Apply reduction by grouping intermediate entries by category and combining each group into a result.

Read how Advanced Algorithms and Data Structures explains reduction operation →

Secrets of the JavaScript Ninja, Second Edition

An Array method that applies a callback across elements to accumulate a single result.

How it is used
Replaces a manual aggregation loop when array items must produce one result.
How deep it goes
Explains the initial value, callback arguments, and final result through a worked sum; leaves engine details aside.
Examples
Sums `[1, 2, 3, 4]` from an initial value of `0` to produce `10`.
What you can do after
Apply it via `Array.reduce` to accumulate array items into one value.

Read how Secrets of the JavaScript Ninja, Second Edition explains reduction operation →

Essential TypeScript 5, Third Edition

The reduce method applies a function across an array's elements to produce a single accumulated result.

How it is used
Uses array reduction to sum a variable number of function arguments into one result.
How deep it goes
Works through callbacks, an initial value, string concatenation, numeric conversion, and `NaN` handling without exploring reduce internals.
Examples
Shows a price-summing function that first concatenates a string price, then converts values and substitutes zero for `NaN`.
What you can do after
Build it from scratch as a variable-argument sum that handles string prices and values that convert to `NaN`.

Read how Essential TypeScript 5, Third Edition explains reduction operation →

React in Depth

A reducer is a function that computes a new state from the current state and an action describing a requested change.

How it is used
Centralizes playlist reordering and shared application-state transitions behind explicit actions.
How deep it goes
Works through generic reducer typing and a reorder-hook implementation, noting the React 19 typing change.
Examples
Uses a reorderable song playlist and shared data for a list of things.
What you can do after
Build a generic reorderable-list hook with a typed reducer and expose its actions to a playlist component.

Read how React in Depth explains reduction operation →

The Well-Grounded Rubyist, Fourth Edition

inject, also known as reduce, is an Enumerable method that combines collection elements through an accumulator and a block, optionally starting with an initial value.

How it is used
Aggregates collection elements into a result by carrying an accumulator through iteration.
How deep it goes
Explains accumulator initialization, iteration, final return values, and symbol shorthand through a worked sum.
Examples
Uses an array sum, symbol shorthand, and direct File reduction to calculate an average.
What you can do after
Apply inject or reduce to aggregate collections without mutating the input.

Read how The Well-Grounded Rubyist, Fourth Edition explains reduction operation →

The Joy of JavaScript

A function or method that combines a collection of values into a single accumulated result.

How it is used
Uses reduction to accumulate collection values and to fold functions into a composition.
How deep it goes
Explains reducer callbacks, accumulation, and observable completion, with array and operator implementations.
Examples
Demonstrates summing an array, composing functions, and reducing observable values.
What you can do after
Apply Array#reduce to accumulate values, or use a custom observable operator to emit an accumulated result on completion.

Read how The Joy of JavaScript explains reduction operation →

Related concepts

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.