Lambda Calculus
Everything in Lambda Calculus is an expression, which means that everything must evaluate to a value.
There are, however, four different forms of expressions (which we’ll call E). An E can be either:
- ID - Identifier
- λID. E - Abstraction.
- E E - Application
- (E) - Grouping
Identifiers
Identifiers are simply that: identifiers. They identify certain values by giving them a “name”.
const x = 10;
x; // identifier equivalent
Abstractions
Abstractions are perhaps the most iconic kind of lambda expression, they define what we call functions or, more adequately, lambdas: which are just anonymous functions.
The ID in the beginning of that abstraction is called the meta-variable. The meta-variable is the variable that is going to be used in the function’s body.
x => x * x; // abstraction equivalent
Application
Applications denote function invocation. If we have a function A we can say we’re calling it with B by writing A B.
const a = x => x * x;
const b = 10;
a(b); // application equivalent
Grouping
Grouping exists for the sake of disambiguation. We use these parentheses around the expressions we want to group to make it clear which ones of them we want to apply to each other.