🔥

Thread (@thewizardlucas)


Continuing the thread about Lambda Calculus from yesterday! In this one, we'll go through the very basics and talk about how it actually works👇

Everything in Lambda Calculus is an expression, which means that everything must evaluate to a value. There are, however, four different forms of expressions. An expression can be either: ID - Identifier λID. E - Abstraction. E E - Application (E) - Grouping

➡️Identifiers are simply that: identifiers. They identify certain values by giving them a “name”, just like our modern programming languages do.

➡️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. a => b => a is equivalent to an abstraction, for example.

The ID in the beginning of that abstraction is called the metavariable. The metavaraible is the variable that is going to be used in the function’s body. In a => a, you have "a" as a metavariable.

➡️ Applications denote function invocation. If you have a function A you can say you’re calling it with B by writing: A B. In JS, that would be something like: (a => b => a)(first)(second)

➡️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.