λs in functional programming
Before we look at things in more depth, let's look at some general background to lambdas.
If you haven't seen it before, the Greek letter λ (lambda) is often used as shorthand when talking about lambdas.
1930s and the lambda calculus
In computer science, lambdas go back to the lambda-calculus. A mathematical notation for functions introduced by Alonzo Church in the 1930s. It was a way to explore mathematics using functions and was later re-discovered as a useful tool in computer science.
It formalized the notion of lambda terms and the rules to transform those terms. These rules or functions map directly into modern computer science ideas. All functions in the lambda-calculus are anonymous which again has been taken literally in computer science.
Here's an example of a lambda-calculus expression:
A lambda-calculus expression
λx.x+1This defines an anonymous function or lambda with a single argument
x
. The body follows the...