Lambda (programming)
Appearance
In programming languages such as Lisp, C# and Python, lambda is an operator used to denote anonymous functions or closures, following the usage of lambda calculus.
Examples
An example of this use of lambda in the Python language is this section of computer code that sorts a list alphabetically by the last character of each entry:
>>> stuff = ['woman', 'man', 'horse', 'boat', 'plane', 'dog']
>>> sorted(stuff, key=lambda word: word[-1])
['horse', 'plane', 'dog', 'woman', 'man', 'boat']
In C#, lambda expressions are often used with LINQ:
var allWikipediaPages = GetAllWikipediaPages();
var lambdaWikipediaPage = allWikipediaPages.First(wp => wp.Title == "Lambda (programming)");