Accumulator
An accumulator is a value or operation that combines successive inputs into an intermediate result carried forward through a computation.
Secrets of the JavaScript Ninja, Third Edition
An accumulator is the intermediate value carried from one reduction step to the next and returned after the final step.
- How it is used
- Carries an intermediate value through JavaScript array reduction to produce one final result.
- How deep it goes
- Explains the initial value, callback arguments, successive returned values, and final result without exploring reduce internals.
- Examples
- Compares a summing loop with reduce over [1, 2, 3, 4], starting at 0 and returning 10.
- What you can do after
- Evaluate/understand how a reduce callback builds a number or another kind of value from an array.
Read how Secrets of the JavaScript Ninja, Third Edition explains accumulator →
Clojure: The Essential Reference
An accumulator is the value representing the result of a reduction after processing some prefix of the input.
- How it is used
- Carries partial results through Clojure reductions.
- How deep it goes
- Defines the accumulator and explains update order, initial values, and empty-input behavior.
- Examples
- Shows running sums of squares, word counts, and a running average with a vector accumulator.
- What you can do after
- Apply it via Clojure reduce and reductions to compute final or running results.
Read how Clojure: The Essential Reference explains accumulator →
Build a DeepSeek Model (From Scratch)
An accumulator is a hardware register that stores a running sum of products during a computation.
- How it is used
- Explains why low-precision matrix multiplication can lose accuracy during intermediate summation.
- How deep it goes
- Defines the register, derives its dot-product role, and explains periodic precision promotion without detailing implementation code.
- Examples
- Uses Y = WX, thousands of products at k = 4096, and Tensor Core bursts promoted into FP32 registers.
- What you can do after
- Diagnose numerical error from insufficient accumulation precision and understand promotion between GPU compute units.
Read how Build a DeepSeek Model (From Scratch) explains accumulator →
100 Java Mistakes and How to Avoid Them
An accumulator function combines two values during a reduction operation to produce another value.
- How it is used
- Validates reduction functions used with Java Stream API operations.
- How deep it goes
- Explains associativity, identity, sequential behavior, and parallel failure, but stops short of general reduction implementation details.
- Examples
- Uses List.hashCode and a Java reduce expression whose multiplication-based accumulator fails under parallel evaluation.
- What you can do after
- Evaluate reduction accumulators against identity and associativity requirements before using sequential or parallel streams.
Read how 100 Java Mistakes and How to Avoid Them explains accumulator →
Grokking Simplicity
A function passed to a reduction operation that combines the accumulated result with the current sequence element.
- How it is used
- Supports reduce operations that combine sequence elements into totals, strings, maps, or other accumulated results.
- How deep it goes
- Defines the two arguments, return rule, initialization, and iteration behavior, but does not descend into implementation internals beyond a loop.
- Examples
- Uses purchase counting, string concatenation, numeric sum and product, and minimum or maximum exercises.
- What you can do after
- Apply it via reduce to build accumulation functions with appropriate initial values.
The Well-Grounded Rubyist, Fourth Edition
An accumulator is a value carried across iterations and replaced by each iteration's calculated result.
- How it is used
- Carries iteration results forward when reducing a collection or collecting block results into a new array.
- How deep it goes
- Traces initialization, replacement, and final return in inject, then shows accumulator-array construction for map.
- Examples
- Uses a four-number sum and a name-uppercasing map, including a map block whose puts calls yield nil results.
- What you can do after
- Build it from scratch by accumulating block results in a my_map method, or apply it with inject to reduce values.
Read how The Well-Grounded Rubyist, Fourth Edition explains accumulator →
CUDA for LLMs
An accumulator is a storage location that holds an incrementally updated result during a computation.
- How it is used
- Uses an accumulator as the existing matrix term in tensor-core matrix multiply-accumulate operations.
- How deep it goes
- Defines the accumulator’s role in D = A × B + C and notes typical FP32 accumulation, without detailing its implementation.
- Examples
- Contrasts full GEMM, C = α × (A × B) + β × C, with tensor-core MMA, D = A × B + C.
- What you can do after
- Evaluate whether a workload suits tensor-core accumulation by checking its matrix structure, dimensions, layouts, and precision.
Also covered in
- Elixir in Action, Third Edition
- F# in Action: A Revised Edition of Get Programming with F#
- Kotlin in Action, 2E
- MongoDB 8.0 in Action, Third Edition
- Learn Haskell by Example
What to know first
- listA list is an ordered collection of elements arranged in a sequence.
- bfloat16bfloat16 is a 16-bit floating-point format with one sign bit, eight exponent bits, and seven fraction bits, providing a wide numerical range with reduced precision.
- float16float16 is a 16-bit floating-point format, commonly IEEE 754 binary16, with less precision and range than 32-bit floating-point formats.
Related concepts
- maximumincludes · A maximum is the greatest element in a collection or range under a specified ordering.
- reduction operationused by · A reduction operation combines multiple input values according to a rule to produce fewer results, often a single aggregate.
- Aggregateused by · Aggregate is a collection operation that repeatedly applies an accumulator function to a sequence’s elements to produce a result.
- aggregation pipelineuses · An aggregation pipeline is an ordered sequence of data-processing stages that filters, transforms, combines, or summarizes records.
- data aggregationpart of · Data aggregation is the process of combining multiple data values, records, or observations into a consolidated or summarized result.
Questions about accumulator
What is accumulator?
An accumulator is a value or operation that combines successive inputs into an intermediate result carried forward through a computation.
Which Manning books explain accumulator?
Secrets of the JavaScript Ninja, Third Edition, Clojure: The Essential Reference, Build a DeepSeek Model (From Scratch), 100 Java Mistakes and How to Avoid Them, Grokking Simplicity, The Well-Grounded Rubyist, Fourth Edition and CUDA for LLMs.
What should I know before learning accumulator?
Manning books that teach accumulator usually introduce list, bfloat16, sum and float16 first.
What kinds of accumulator are there?
Kinds of accumulator include $avg and maximum.
What is accumulator part of?
Accumulator is part of data aggregation. Data aggregation is the process of combining multiple data values, records, or observations into a consolidated or summarized result.
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.






