Why we need to talk about lambda, aka. λ, at the very beginning?

Look at the definition: Lambda contains a transforming rule (substitution from a variable) and a syntax for declaring function. The generic usage of Lambda calculation is that any calculating function can be represented and calculated by lambda. Therefore, it is equivalent to the Turing machine

Lambda is a mapping relationship between x to y. It is equivalent to the anonymous function in most of Functional Programming Languages. The reason of being named as lambda expression is that these functions are always used once or few times, which do not need function name.

Anonymous function can be passed into another function as a parameter, or returned as a closure.

However, an anonymous function is not necessarily a lambda calculus, because an anonymous function may accept multiple parameters, while, the lambda calculus accepts only one parameter, like:

multiple(x, y) = x*y

Simplify to a mapping expression, removing the function name:

(x,y) -> x*y

Is this a lambda? Negative. Lambda is not just a simple mapping relationship without function name, but also a mapping from only single parameter.

Precisely speaking, let's look at into the mapping process above:

  1. We create a lambda accepting only one parameter:

     (x) -> (y -> x*y)       // lambda A
  2. lambda A gives (returns) us another lambda which also accepts one parameter:

     (y -> x*y)
     // lambda B, which is returned from inside of lambda A
  3. For example, we pass number 5 into lambda A:

     (5) -> (y -> 5*y)
  4. Then we get another lambda B1, with number 5 in it:

     (y -> 5*y)              // lambda B1
  5. This lambda y -> 5*y is a mapping from y to 5*y, if we pass number 4 into lambda B1, we get:

     4 -> 5*4

That is, the anonymous function (x,y)->x*y is the combination of two lambdas, instead of one lambda as it looks like.

The way that a function accepting single parameter returns another function that accepts the second single parameter is called Curring. We will talk about Curring more in Chapter 02.

Before we go deeper in Curring, let's look at how to use lambda in JavaScript at first.