# Some history about Functional programming - I

Functional Programming (FP) is not a new concept and it has some history that it based on to be at this form we use nowadays. this history starts with Ξ» lambda calculus.

## Ξ» lambda calculus

Lambda calculus was introduced by Alonzo church in the 1930s as apart of an investigation into the foundation mathematics.

Lambda calculus is a typeless theory of functions, it describe a notion of a function in computational perspective.

Function in lambda calculus is a black box , what it dose that it take some input, so may it takes a number like x and itβs going to process it in someway and itβs going to produce an output.

Thereβs two facts about functions in Ξ» calculus:

functions are black box so you are not allowed to look inside, you canβt see the mechanism of whatβs going on.

functions are pure so they have no internal state, no hidden information that we can use.

Whatβs the point of Ξ» calculus?

You can encode any computation into lambda calculus function.

It build the basis of functional programming.

What you can do with Ξ» calculus?

lambda calculus basically got nothing in it, no data types no recursion or even control structure, all we got is variables, a way of building functions and a way of applying those functions.

so we have to encode almost everything you need to build your program logical operators, loops, recursions, β¦etc

How to define functions in Ξ» calculus?

To define a function that take single input x and increment that input by one you may define your function in that way

Ξ»x. x+1

x is the input, x+1 is the output

To define another function that take two inputs and return the summation as the output you may type your function in that way.

Ξ»x.Ξ»y x+y

here the function take two inputs x, y and return the summation of them as output.

also you can decode some logic operators as function in lambda calculus here an example, letβs encode true and false into functions

If true were a function it would be a function that take two arguments and return the first one,

so TRUE function would be like

Ξ»x.Ξ»y x

and the same for FALSE function it would be a function that takes two arguments and return the second one as output,

Ξ»x.Ξ»y y

Thatβs was a very simple introduction about lambda calculus.

hereβs some resources where i read about lambda calculus.

https://www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf

https://en.wikipedia.org/wiki/Lambda_calculus

## Top comments (0)