Reduction operation
A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate.
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 →
GPU Programming with Triton
A reduction combines multiple values into fewer values using an associative operation such as a sum, maximum, or minimum.
- How it is used
- Uses reductions to compute shared statistics for normalization, softmax, and gradient accumulation on GPUs.
- How deep it goes
- Explains reduction trees, GPU communication, numerical behavior, and Triton implementation patterns through fused kernels.
- Examples
- Uses an eight-value tree sum, two-pass and atomic global sums, and a fused softmax kernel.
- What you can do after
- Apply reductions via Triton primitives, choosing tile-local, two-pass, or atomic patterns and accounting for numerical precision.
Read how GPU Programming with Triton 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 →
Grokking GPU Programming
The reduction pattern combines many input values into one result using an associative operation, often by combining partial results in parallel.
- How it is used
- Uses reduction to combine partial results in GPU computations and as a building block for data processing and neural network training.
- How deep it goes
- Develops a shared-memory tree reduction through synchronization and multi-block combination, then notes library implementations and floating-point ordering effects.
- Examples
- Uses exam-score subtotals, an integer-array sum, and PyTorch sum, maximum, and product calls.
- What you can do after
- Builds a CUDA integer-sum reduction from scratch and applies reductions via PyTorch.
Read how Grokking GPU Programming explains reduction operation →
CUDA for LLMs
A reduction combines multiple input values into an aggregate through an operation such as a sum.
- How it is used
- Uses reductions to coordinate aggregate computations in GPU neural-network kernels and distributed collectives.
- How deep it goes
- Works through sequential scans, warp shuffles, and shared-memory reductions, with profiling and synchronization tradeoffs.
- Examples
- Illustrates bias-gradient sums, warp-level dot products, softmax normalization, and fused LayerNorm.
- What you can do after
- Build CUDA reductions from scratch using partial sums, warp shuffles, and shared-memory collaboration.
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 →
Learn Rust in a Month of Lunches
- How it is used
- Uses `.fold()` to combine iterator items into a final value, including sums and aggregated event data.
- How deep it goes
- Explains the starting value and closure inputs, then works through numeric and struct-based folds.
- Examples
- Demonstrates adding integers, combining event records, and finding floating-point extrema.
- What you can do after
- Apply Rust’s `.fold()` to sum values, aggregate events into a struct, or find floating-point extrema.
Read how Learn Rust in a Month of Lunches 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.
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 →
100 C++ Mistakes and How to Avoid Them
Reduction is a data-processing operation that combines multiple input elements into a single resultant value.
- How it is used
- Uses reduction as the final step after mapping and filtering a value stream.
- How deep it goes
- Demonstrates std::accumulate over a filtered range in a code example.
- Examples
- Maps values to absolute values, filters for even values, then sums the retained integers.
- What you can do after
- Apply std::accumulate to sum values produced by a composed ranges pipeline.
Read how 100 C++ Mistakes and How to Avoid Them 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 →
Julia as a Second Language
reduce is a collection operation that combines elements by repeatedly applying a function to accumulate a result.
- How it is used
- Turns a collection into one result, often after mapping or filtering its values.
- How deep it goes
- Defines reduce through its binary function and demonstrates it with operators, aggregate functions, and mapreduce.
- Examples
- Uses pizza-sale totals, range sums, factorial, and a Taylor-series sine calculation.
- What you can do after
- Apply reduce with a binary function, or combine mapping and reduction with mapreduce.
Read how Julia as a Second Language explains reduction operation →
Also covered in
- Grokking Simplicity
- Kafka Streams in Action, Second Edition
- Functional Programming in JavaScript
- Secrets of the JavaScript Ninja, Third EditionIn early access (MEAP)
- React Hooks in Action: With Suspense and Concurrent Mode
- Learn Haskell by Example
- Python Concurrency with asyncio
- The Cloud at Your Service: The when, how, and why of enterprise cloud computing
- Distributed Machine Learning Patterns
- Elixir in Action, Third Edition
- Data-Oriented Programming: Reduce software complexity
- 100 Java Mistakes and How to Avoid Them
What to know first
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- 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.
- MapA map is an associative data structure that stores key-value associations and supports retrieving values by key.
- loopA loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.
Related concepts
- higher-order functionkind of · A higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
- stateuses · State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
- redux actionuses · A Redux action is a JavaScript object describing an event or requested state transition for a reducer to process.
- softmaxused by · Softmax is a function that exponentiates each value in a score vector and normalizes the results to produce positive values summing to one, forming a probability distribution.
- data aggregationcontrasts with · Data aggregation is the process of combining multiple data values, records, or observations into a consolidated or summarized result.
- dynamic quantizationused by · Dynamic quantization is a method that determines or adjusts quantization parameters at runtime from the values being processed, often quantizing activations during inference.
Questions about reduction operation
What is reduction operation?
A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate.
Which Manning books explain reduction operation?
Clojure: The Essential Reference, GPU Programming with Triton, React Quickly, Second Edition, Grokking GPU Programming, CUDA for LLMs, Build a Frontend Web Framework (From Scratch), Advanced Algorithms and Data Structures, Secrets of the JavaScript Ninja, Second Edition and 7 more.
What should I know before learning reduction operation?
Manning books that teach reduction operation usually introduce array, functional programming, Map and loop first.
What is the difference between reduction operation and data aggregation?
A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate. Data aggregation is the process of combining multiple data values, records, or observations into a consolidated or summarized result.
What is reduction operation a kind of?
Reduction operation is a kind of higher-order function. A higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
What is reduction operation also called?
Reduction operation is also called reduce, fold, inject or parallel reduction.
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.














