Lambda
A lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
Kotlin in Action, 2E
A function literal is source syntax that directly expresses a function value, including its parameters and body.
- How it is used
- Passes small behavior blocks to event handlers, collection operations, and higher-order functions.
- How deep it goes
- Explains syntax, inference, captures, Java conversion, and labeled-return edge cases; defers inline implementation details.
- Examples
- Demonstrates click listeners, oldest-person selection, response counting, Java Runnable calls, and labeled collection iteration.
- What you can do after
- Apply it via Kotlin standard-library and Java functional-interface APIs to express reusable behavior concisely.
The Well-Grounded Rubyist, Fourth Edition
A lambda is a Ruby callable object representing an anonymous function with lambda-specific argument and return behavior.
- How it is used
- Uses lambdas as stored callable functions and reusable transformations.
- How deep it goes
- Explains construction, strict arity, explicit creation, and return behavior through calls and contrasts, then applies currying without detailing Proc internals.
- Examples
- Tests missing and extra arguments, contrasts return behavior, multiplies two values, and curries an array filter.
- What you can do after
- Build it from scratch with `lambda` or `->`, and apply `curry` to make reusable functions.
Read how The Well-Grounded Rubyist, Fourth Edition explains lambda →
Pro ASP.NET Core 7, Tenth Edition
A lambda expression is an anonymous function expression whose parameters and implementation can be used as a delegate or compatible callable value.
- How it is used
- Supplies inline filtering rules, endpoint functions, and Blazor event callbacks without a separate method for each behavior.
- How deep it goes
- Works through delegate-compatible filtering and lambda syntax, then demonstrates expression-bodied members; does not examine compiler internals.
- Examples
- Uses product-price and name filters, an expression-bodied controller action, an endpoint function, and generated counter buttons.
- What you can do after
- Apply it in C# to supply filtering rules, concise members, endpoint handlers, and parameterized Blazor event handlers.
Read how Pro ASP.NET Core 7, Tenth Edition explains lambda →
Functional Programming in Scala, Second Edition
A function expression without a declared name, typically written using parameter and body syntax.
- How it is used
- Deploys inline function values as arguments to higher-order functions and as reusable building blocks for functional data processing.
- How deep it goes
- Defines lambda syntax, type inference, underscore shorthand, and composition, while deferring precise underscore-scoping rules to the language specification.
- Examples
- Uses findFirst predicates, array-sorting comparisons, charge coalescing, foldRight arithmetic, and underscore expressions.
- What you can do after
- Apply it via higher-order functions, predicates, folds, currying, composition, and concise Scala collection operations.
Read how Functional Programming in Scala, Second Edition explains lambda →
Grokking Simplicity
A function expression that has no name and can be defined inline where it is used.
- How it is used
- Uses short, context-specific behavior as an inline argument to higher-order functions such as map(), forEach(), and withLogging().
- How deep it goes
- Defines anonymous functions through global, local, and inline contrasts, then demonstrates callbacks; stops short of implementation internals.
- Examples
- Demonstrates logging callbacks, customer email generation, greetings, array iteration, grouping, and moving-average pipelines.
- What you can do after
- Apply it via map() and forEach() to pass one-use behavior directly where iteration or another operation consumes it.
C++ Concurrency in Action, Second Edition
A lambda expression is a C++ expression that defines an unnamed callable, optionally capturing variables from its surrounding scope.
- How it is used
- Uses lambdas to provide inline work for threads, predicates for condition-variable waits, and handlers for messages.
- How deep it goes
- Defines lambdas and illustrates practical uses, while deferring full expression details.
- Examples
- Shows thread work, a queue-nonempty wait predicate, and message handlers that update ATM state.
- What you can do after
- Apply lambda syntax to launch thread work, supply condition-variable predicates, and handle typed messages.
Read how C++ Concurrency in Action, Second Edition explains lambda →
Python How-To
The lambda keyword introduces a Python expression that defines an anonymous function.
- How it is used
- Uses lambdas for small, one-time functions passed to sorting and filtering operations.
- How deep it goes
- Explains lambda syntax and calls, then works through readability and debugging trade-offs.
- Examples
- Demonstrates sorting tasks by urgency, filtering urgent tasks, and replacing a lambda with the built-in abs function.
- What you can do after
- Apply lambdas to small Python sorting and filtering jobs, and choose named or built-in functions when more suitable.
The Art of Code
A lambda is an anonymous function value that can be passed, stored, returned, or invoked as data.
- How it is used
- Expresses behavior compactly and lets functions be passed, stored, returned, or invoked as data.
- How deep it goes
- Explains arrow syntax, functional-interface use, and first-class functions through examples across several languages.
- Examples
- Shows a string-length predicate, lambdas stored in a list, and alternatives for iterating over publication dates.
- What you can do after
- Apply lambdas to implement functional interfaces and pass, store, return, or invoke behavior as data.
100 C++ Mistakes and How to Avoid Them
A lambda expression is a C++ expression that defines an anonymous callable object, optionally capturing surrounding state.
- How it is used
- Keeps one-off behavior beside its use instead of requiring a separate function or functor.
- How deep it goes
- Compares lambdas with functors and standalone comparison functions through sorting and maximum examples.
- Examples
- Shows a maximum calculation and student comparisons by name, age, or GPA.
- What you can do after
- Apply lambdas with std::sort or std::accumulate to define behavior at the call site.
Read how 100 C++ Mistakes and How to Avoid Them explains lambda →
Modern C, Third Edition
An anonymous function is a function construct without a program-level name, provided by a C extension for embedding callable behavior in expressions or macros.
- How it is used
- Implements convenient generic operations inside macros by embedding callable behavior in an expression.
- How deep it goes
- Explains capture syntax, inferred const semantics, immediate invocation, and termination, but does not develop broader lambda mechanics.
- Examples
- Uses SWAP expansions that capture operand addresses and exchange their pointed-to values.
- What you can do after
- Build it from scratch as an immediately invoked lambda inside a generic macro.
Functional Programming in C#, Second Edition
A lambda expression is an anonymous function expression that can be converted to a compatible delegate or expression tree in C#.
- How it is used
- Uses lambdas to represent and pass small functions in functional C# code.
- How deep it goes
- Explains inline delegate implementations, variable assignment, type inference, and access to enclosing variables through compact examples.
- Examples
- Demonstrates numeric selection, alphabetical sorting, day-of-week filtering, and a square function.
- What you can do after
- Apply lambdas in C# to pass comparison and filtering operations or assign a function to a variable.
Read how Functional Programming in C#, Second Edition explains lambda →
.NET in Action, Second Edition
An anonymous method is a C# method implementation declared without a named method declaration and commonly represented as a delegate or function value.
- How it is used
- Supplies one-off callbacks, such as handling command-line parsing failures, without requiring a named method.
- How deep it goes
- Defines expression and statement lambdas, demonstrates delegate assignment and type inference, but does not detail generated runtime representation.
- Examples
- Compares named handlers with lambdas and demonstrates printing, string comparison, multiplication, summation, and parsing.
- What you can do after
- Apply Action and Func delegates to write inline callbacks and expression- or statement-bodied functions.
100 Java Mistakes and How to Avoid Them
A lambda expression is an anonymous Java function-like expression that provides an implementation compatible with a functional interface.
- How it is used
- Uses lambda syntax to make functional-interface arguments and overloaded target selection explicit.
- How deep it goes
- Explains parameter flow, ignored arguments, overload ambiguity, and constructor binding through focused Java examples, without runtime internals.
- Examples
- Uses Integer.sum, StringBuilder factories, map initialization, and Arrays.setAll to contrast method references with explicit lambdas.
- What you can do after
- Diagnose/debug with lambda conversion when a method reference selects an unintended overload or constructor.
Read how 100 Java Mistakes and How to Avoid Them explains lambda →
Python Workout, Second Edition
lambda is Python syntax for creating an anonymous function from parameters and a single expression.
- How it is used
- Deploys anonymous functions for one-use sorting keys and callbacks.
- How deep it goes
- Explains function objects, inline use, and readability tradeoffs, but stops short of broader lambda semantics.
- Examples
- Uses country dictionaries, string sorting, and a greeting callback to demonstrate anonymous functions.
- What you can do after
- Apply lambda to create one-use sorting keys and pass anonymous callbacks to functions.
100 Go Mistakes and How to Avoid Them
An anonymous function is a function defined without an explicit name.
- How it is used
- Uses anonymous functions to defer cleanup, configure APIs through options, and launch goroutines with captured values.
- How deep it goes
- Explains closure capture through configuration and goroutine examples, and traces deferred error propagation with named results.
- Examples
- Uses rows.Close error handling and goroutines over loop values to demonstrate practical closure behavior.
- What you can do after
- Apply anonymous functions to deferred cleanup and functional options, or avoid loop-variable capture by snapshotting or passing values.
Read how 100 Go Mistakes and How to Avoid Them explains lambda →
Build Python Web Apps with Streamlit
A lambda function is an anonymous Python function defined as a single expression, typically for short computations.
- How it is used
- Uses short anonymous functions for password validation rules and configurable dashboard metrics.
- How deep it goes
- Defines single-expression functions and demonstrates evaluation, but stops short of broader lambda mechanics.
- Examples
- Demonstrates password-rule predicates and sales or gross-margin aggregation in metric configuration.
- What you can do after
- Apply lambdas to compact validation rules and dataframe metric calculations, choosing regular functions for longer guarded logic.
Read how Build Python Web Apps with Streamlit explains lambda →
Learn Go with Pocket-Sized Projects
An anonymous function is a function value declared without a name, typically for inline or temporary use.
- How it is used
- Uses lambdas for inline sorting rules and short concurrent tasks.
- How deep it goes
- Defines lambdas, demonstrates sorting, and explains loop-variable capture, but does not develop closure internals broadly.
- Examples
- Demonstrates book sorting and concurrent maze exploration with a parameterized goroutine function.
- What you can do after
- Apply it via sort.Slice and goroutines while avoiding older Go loop-variable capture problems.
Read how Learn Go with Pocket-Sized Projects explains lambda →
ASP.NET Core in Action, 3e
A lambda expression is an anonymous function expression that can be passed or assigned as a value.
- How it is used
- Connects ASP.NET Core minimal API endpoints and middleware pipeline methods to executable behavior.
- How deep it goes
- Defines direct and assigned lambdas through working handlers, then contrasts alternatives without exploring language internals.
- Examples
- Uses fruit CRUD endpoints, an assigned get-by-id lambda, and custom middleware built with pipeline extension methods.
- What you can do after
- Apply it via ASP.NET Core minimal APIs by writing inline handlers or assigning lambdas before endpoint registration.
The Quick Python Book, Fourth Edition
A lambda expression is an anonymous function expression that evaluates to a function value and returns the value of its expression body.
- How it is used
- Uses short anonymous functions inline, especially as sort keys or dictionary values.
- How deep it goes
- Defines lambda syntax, implicit returns, and practical examples, without descending into implementation details.
- Examples
- Demonstrates word-length sorting and temperature-conversion lambdas stored in a dictionary.
- What you can do after
- Apply lambda expressions through Python's sort method or by storing and calling them as dictionary values.
Read how The Quick Python Book, Fourth Edition explains lambda →
Secrets of the JavaScript Ninja, Second Edition
A function that has no name.
- How it is used
- Defines arrow functions as a compact way to create JavaScript function values.
- How deep it goes
- Introduces ES6 arrow syntax and flags a callback-related benefit, while deferring its explanation.
- Examples
- Uses `myArg => myArg*2` to show a one-argument arrow function doubling its input.
- What you can do after
- Build a concise arrow function using the form `myArg => myArg*2`.
Read how Secrets of the JavaScript Ninja, Second Edition explains lambda →
Also covered in
- Learn C++ by Example
- Tiny Python Projects: Learn coding and testing with puzzles and games
- Pandas Workout: 200 exercises to make you a stronger data analyst
- Elixir in Action, Third Edition
- Practices of the Python Pro
- Build and Orchestrator in Go (From Scratch)
- Python Workout: 50 ten-minute exercises
- C# Concurrency: Asynchronous and multithreaded programming
- Julia as a Second Language
- Learn Concurrent Programming with Go
- Learn Haskell by Example
- Functional Design and Architecture: Examples in Haskell
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.
- 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.
- higher-order functionA higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
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.
- higher-order functionused by · A higher-order function is a function that accepts functions as arguments, returns functions as results, or both.
- functional interfaceuses · A functional interface is an interface with exactly one abstract operation, making it compatible with implementation by a function, lambda expression, or method reference.
- to_procproduced by · to_proc is a Ruby conversion method that produces a Proc callable from an object such as a symbol.
Questions about lambda
What is lambda?
A lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
Which Manning books explain lambda?
Kotlin in Action, 2E, The Well-Grounded Rubyist, Fourth Edition, Pro ASP.NET Core 7, Tenth Edition, Functional Programming in Scala, Second Edition, Grokking Simplicity, C++ Concurrency in Action, Second Edition, Python How-To, The Art of Code and 12 more.
What should I know before learning lambda?
Manning books that teach lambda usually introduce function, Map, loop and higher-order function first.
What is lambda a kind of?
Lambda 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.
What is lambda also called?
Lambda is also called anonymous function or function literal.
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.



















