A variable is said to be bound if it is contained in a lambda expression of the same variable binding. The most notable is the choice of identifiers for the binding variables. The actual implementation of the lambda calculus admits several degrees of freedom in how lambda abstractions are represented. This is merely a syntactical convention and does not change the underlying meaning. Out of convenience we often write multiple lambda abstractions with their variables on one lambda symbol. In the lambda calculus, each lambda abstraction binds a single variable, and the lambda abstraction's body may be another lambda abstraction. x_n )īy convention application extends as far to the right as is syntactically meaningful. Application of multiple expressions associates to the left. There are several syntactical conventions that we will adopt when writing lambda expressions. The variation we will discuss first is known as untyped lambda calculus, by contrast later we will discuss the typed lambda calculus which is an extension thereof. The lambda calculus is often called the "assembly language" of functional programming, and variations and extensions on it form the basis of many functional compiler intermediate forms for languages like Haskell, OCaml, Standard ML, etc. In other words, \(\lambda x.e\) is a function that takes a variable \(x\) and returns \(e\). Using the lambda calculus notation we write: The three terms are typically referred to in code by several contractions of their names:Ī lambda term is said to bind its variable. This means what you see in the picture above would translate to (\x -> x) (\y -> y), which would be equivalent to writing id id (which of course evaluates to id). This compact notation looks slightly different from what you're used to in Haskell but it's actually not: \(\lambda x.xa\) is equivalent to \x -> x a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |