leftheritage.blogg.se

Lambda calculus
Lambda calculus







lambda calculus

Shortly we will look at how we can implement Church encoding for boolean logic and arithmetic of natural numbers. The way we do this is through Church encoding (named after Alonzo Church). In fact, we can compute anything - lambda calculus is Turing complete! Essentially we have a language where the only primitive data type is a function!Īmazingly, from this we can implement operators, data structures and formal systems such as boolean logic and arithmetic.

lambda calculus

With lambda calculus, all we get out of the box are variables, function abstraction, and function application. This StackBlitz demo contains examples of all of the functions discussed and used in this article. Much of what I write about in this article is inspired by the puzzle book To Mock a Mockingbird, by Raymond Smullyan, and also the 2 part YouTube series, A Flock of Functions by Gabrial Lebec. This is a follow up to my previous article, An introduction to Lambda Calculus, explained through JavaScript, which I recommend reading first if you are not familiar with lambda calculus. In particular I will use JavaScript to demonstrate how we can use lambda calculus to implement boolean logic and basic arithmetic.

lambda calculus

In this article I will talk about Church encoding, the mechanism by which we can encode operators and data using lambda calculus.









Lambda calculus