*λx. * 2 x*

See there is no equality sign, here

*λx*is something anonymously like f(x) and the dot after it shows the start of the evaluation formula. So a familiar C or Java-like function like the following:

int doubleIt(int x) {

return 2 * x

}

Will be something like the following in Lisp-like language for example (which you can use it inline of course):

(lambda (x) (∗ 2 x))

The above is nothing but what we already talked about it:

*λx. * 2 x*

**Just one parameter**

Any lambda abstraction can contain only one input parameter, so in general, an abstraction is something like:

*λx. t*

*t*is any valid lambda expression or simply a term. Here are some more examples:

*λx. + x 5**λx. * 2 * x x**λx. + x y*

**Bound and free variables**

Note in the third example y is just an unknown variable for the function, this variable is called free variable while the x is called bound variable. The function gets x and adds y to it. Since we can have abstractions in some part of an anonymous function itself so the third example can be written in the following form to have the meaning we usually like to give it to:

*λy.t , t = + x y =>*

*λy.*

*λx. + x y*

*Or simply as nested abstraction like:*

*λy*

*x. + x y*

In Lisp we write it like:

(lambda (x y) (+ x y))

## No comments:

## Post a Comment