In programming (especially in functional languages), a lambda function (also anonymous function) is a user-defined function without an identifier (i.e., nameless). They’re useful mainly to be passed to higher-order functions or to construct the result of a higher-order function.

Mathematically speaking, lambda functions mainly come from the idea of lambda calculus, where all functions are anonymous.

Language-specific

In Python, we can declare lambda functions as follows:

lambda x: # expression goes here
lambda y: idx[y] # for example

Since C++11, we can construct lambdas with:

auto f = [](auto param1, auto param2) {
	return param1 + param2;
}