HR F#: Lambda Calculus - Evaluating Expressions #2

The first λ-calculus evaluating expression problem was very easy. The second one is similar:

Compute the value of (λx.x+1)((λy.y+2)3).

Just to make a bit more fun from it, let's solve it by writing the code in F#:

(fun x -> x + 1)((fun y -> y + 2)3)
|> printfn "%A"

And in JavaScript:

console.log((x => x + 1)((y => y + 2)(3)));

And in GO:

fmt.Println((func(x int) int { return x + 1; })((func(y int) int { return y + 2; })(3)))

Ok, In C#:

Console.WriteLine(((Func<int,int>)(x=>x+1))(((Func<int,int>)(y=>y+2))(3)));

More extreme, PHP:

print (function($x){ return $x+1; })((function($y){ return $y+2; })(3));

A lot of languages support the anonymous functions, the building block of lambda calculus, althougn not all of them flexible enough for λx.(x x).