I have recently heard people talk about code being "lambda". I have never heard of this phrase before. What does it mean?
Lambda expressions are either an abstraction (sometimes referred to as anonymous function), an application or a variable (most languages also add constants to this list). Lambda terms are not necessarily functions, and not necessarily passed as parameters, though this is a common practice.
A common example of lambda expressions in C#
List<int> items = new List<int>(); items.add(1); items.add(2); items.add(1); items.add(3); int CountofOnes = items.FindAll(item => item == 1).Count(); Console.Out.WriteLine(CountofOnes);
will output: 2
In this code, I pass a lambda construction to the
FindAll function of .NET's
items.FindAll(item => item == 1)
The lambda in this call executes a simple equation and returns a boolean, telling
FindAll what to do.