Map
Map is an operation that applies a function to values in a collection or computational context and returns the results while preserving the structure or context.
Functional Programming in C#, Second Edition
Map is an operation that applies a function to values in a structure and returns the results in the same kind of structure.
- How it is used
- Extends familiar sequence transformations to optional values, computations, generators, and streams.
- How deep it goes
- Implements Map for sequences, options, trees, and computations, and explains composition and the distinction from Bind.
- Examples
- Uses tripled integers, optional risk calculations, recursive trees, lazy functions, and Boolean generators.
- What you can do after
- Builds Map implementations from scratch and applies the pattern to structured values and computations.
Read how Functional Programming in C#, Second Edition explains map →
Grokking GPU Programming
The map pattern applies an operation independently to each element of a collection.
- How it is used
- Introduces independent element-wise work as a starting point for parallel programming.
- How deep it goes
- Works through independence, same-index reads, CUDA indexing, bounds checks, and in-place mistakes.
- Examples
- Uses array doubling, vector addition, and ReLU to illustrate independent transformations.
- What you can do after
- Build it from scratch as a CUDA kernel with one thread per output and a bounds check.
Spring in Action, Sixth Edition
map is a Project Reactor operator that transforms each value emitted by a reactive publisher into another value while preserving the publisher type.
- How it is used
- Transforms values within reactive pipelines, including authentication and aggregate persistence.
- How deep it goes
- Explains synchronous per-value transformation with worked tests and contrasts it with publisher flattening and asynchronous scheduling.
- Examples
- Maps player-name strings to Player objects and repository users to authentication details.
- What you can do after
- Apply it via Project Reactor to convert emitted values and choose flatMap() when a transformation returns a publisher.
Learn Haskell by Example
map is a standard Haskell function that applies a function independently to every element of a list and returns the resulting list.
- How it is used
- Applies a per-element transformation across strings and lists in cipher, input-processing, and formatting tasks.
- How deep it goes
- Defines ordered element-wise list transformation and demonstrates composition, while deferring any implementation of `map` itself.
- Examples
- Uses Caesar and ROT13 ciphers, uppercase console input, and nested `show` and `length` transformations for line numbering.
- What you can do after
- Apply it via Haskell's `map` to transform every element of a list while keeping element logic separate.
Clojure: The Essential Reference
map is a Clojure function that applies a function to corresponding elements of one or more collections and returns a lazy sequence of results.
- How it is used
- Transforms corresponding elements of sequentially iterable collections in functional data pipelines.
- How deep it goes
- Details three arity patterns, lazy results, shortest-input termination, and the caveat against relying on once-only side effects.
- Examples
- Demonstrates negating a range, combining strings from uneven collections, and assigning indices to keywords.
- What you can do after
- Apply it via Clojure’s map to transform one or several collections, or use its collection-free arity as a transducer.
Secrets of the JavaScript Ninja, Third Edition
A JavaScript method that creates a new array by applying a callback to each element of an array.
- How it is used
- Derives an array of values from an existing array, such as extracting a property from each object.
- How deep it goes
- Defines callback-to-result behavior and demonstrates it with a worked array example, without implementing the method itself.
- Examples
- Extracts weapon strings from an array of objects and compares the result with a for…of loop using push.
- What you can do after
- Apply it via JavaScript’s map method to create an array from callback return values.
Read how Secrets of the JavaScript Ninja, Third Edition explains map →
D3.js in Action, Third Edition
The JavaScript map() method creates a new array by applying a callback to every element of an input array.
- How it is used
- Transforms loaded datasets into arrays of values needed for data wrangling and visualization.
- How deep it goes
- Defines callback-based array transformation with working results, but stops short of broader array and object manipulation techniques.
- Examples
- Uses employee names and dataset years as mapped arrays for labels, scale domains, and chart positioning.
- What you can do after
- Apply it via JavaScript to reshape array data for D3 scales and other visualization operations.
Secrets of the JavaScript Ninja, Second Edition
An Array method that creates a new array by applying a callback to each element.
- How it is used
- Uses map to transform array items into a new array as one common array operation.
- How deep it goes
- Defines callback-based transformation and demonstrates extracting object properties, without detailing further mechanics.
- Examples
- Extracts weapon names from an array of ninja objects and compares map with forEach and push.
- What you can do after
- Apply Array.map to transform an array of objects into an array of their weapon properties.
Read how Secrets of the JavaScript Ninja, Second Edition explains map →
F# in Action: A Revised Edition of Get Programming with F#
A map operation applies a function to a value inside a computational effect and rewraps the result in that effect.
- How it is used
- Transforms values inside lists and other effects without hand-writing each effect check.
- How deep it goes
- Explains lifting and effect-specific behavior with examples, but points to open-source implementations rather than tracing their internals.
- Examples
- Uses integer-to-string transformations across Option, Result, and List, plus a pipelined List.map example.
- What you can do after
- Apply it via F# List.map, Option.map, or Result.map to transform wrapped values without writing effect checks.
Read how F# in Action: A Revised Edition of Get Programming with F# explains map →
Apache Kafka in Action
map is a stream-processing function that transforms each input record into a new record or value.
- How it is used
- Transforms records in real-time stream-processing topologies, especially when both message key and value must change.
- How deep it goes
- Defines input/output signatures, contrasts mapValues(), and explains repartitioning-related performance loss without detailing implementation internals.
- Examples
- Demonstrates dollar-to-cent conversion with mapValues() and key creation from an unkeyed Apple price record.
- What you can do after
- Apply it via Kafka Streams to transform records, create keys, and write the resulting stream to a topic.
Acing the Frontend Interview
map is a JavaScript array method that applies a callback to each element and returns a new array of the results.
- How it is used
- Uses map to demonstrate clean, predictable, and modular functional transformations in JavaScript interviews.
- How deep it goes
- Demonstrates map with a pure callback and explains predictability, testing, debugging, and immutability without covering implementation internals.
- Examples
- Uses nums.map(n => n * 2) to transform [1, 2, 3] into [2, 4, 6].
- What you can do after
- Apply it via JavaScript’s built-in array method to perform non-mutating element transformations.
Fabulous Adventures in Data Structures and Algorithms
A monadic map operation applies a function to values inside a monadic computational context while preserving that context's structure.
- How it is used
- Transforms ordinary functions into operations over monadic workflows while preserving capabilities such as laziness, nullability, asynchrony, and sequencing.
- How deep it goes
- Defines Map, implements it for Lazy<T>, relates it to Bind and Unit, and stops short of detailed implementations for every context.
- Examples
- Uses Lazy<int>, DivTwo, Nullable<T>, Task<T>, IEnumerable<T>, and the nested Lazy<Lazy<double>> problem.
- What you can do after
- Apply Map to lift ordinary functions into lazy, nullable, asynchronous, or sequence-based workflows and recognize when Bind is required.
Read how Fabulous Adventures in Data Structures and Algorithms explains map →
Also covered in
- The Cloud at Your Service: The when, how, and why of enterprise cloud computing
- Type-Driven Development with Idris
- Rust Servers, Services, and Apps
- Modern Angular
- Grokking Concurrency
- Pro Angular 16
- Essential TypeScript 5, Third Edition
What to know first
- 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.
- listA list is an ordered collection of elements arranged in a sequence.
- side effectA side effect is an observable change or interaction caused by a computation beyond producing its direct result, such as modifying state or interacting with the external environment.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- arrayproduces · An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- binduses · Bind is an operation that chains a value in a computational context to a function returning another value in that context, flattening the resulting nested context.
- functionuses · 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.
- Selectequivalent to · Select is a LINQ sequence operator that applies a selector to each element and returns the resulting projected sequence.
- containeruses · A container is a logical or structural unit that holds, groups, or packages data or other elements as a single entity.
- convolutioncontrasts with · Convolution is an operation that applies a filter or kernel across an input, combining values from local neighborhoods to produce output values.
Questions about map
What is map?
Map is an operation that applies a function to values in a collection or computational context and returns the results while preserving the structure or context.
Which Manning books explain map?
Functional Programming in C#, Second Edition, Grokking GPU Programming, Spring in Action, Sixth Edition, Learn Haskell by Example, Clojure: The Essential Reference, Secrets of the JavaScript Ninja, Third Edition, D3.js in Action, Third Edition, Secrets of the JavaScript Ninja, Second Edition and 4 more.
What should I know before learning map?
Manning books that teach map usually introduce functional programming, list, side effect and array first.
What is the difference between map and convolution?
Map is an operation that applies a function to values in a collection or computational context and returns the results while preserving the structure or context. Convolution is an operation that applies a filter or kernel across an input, combining values from local neighborhoods to produce output values.
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.











