I hope I am contemplating my question correctly.
As far as my understanding, imperative programming (to the very brief) is based on mutation, control structures such as loops and assignments.
While i was following a course about functional programming they have mentioned a point. I want to understand it to depth..
The point is:
If we want to implement high-level concepts following their mathematical theories, there's no place for mutation.
What i have understand from this is, value/co-efficient assigned to particular variable should be same and could not be reassigned time to time to create abstract definition out of it. is it correct ?
Can you add some more points ?
You can think of it this way. At the beginning of the 20th century the level of mathematics has become so high that scientists have been able to apply it to the study of mathematical methods, specifically calculations and evidences.
As a result of research there are two main approaches: Turing machine and lambda calculus.
The first approach (Turing machine) have an idea about a state that is recorded on a tape, and that can be changed. Also this approach have an idea about an algorithm as a sequence of steps.
In the second approach (lambda calculus) any calculation is regarded as a combination of a several functions.
F.e. let's see Taylor series of a sine function:
First expression gives us an example of functional calculation. There's no steps to calculate sine, there's just combination of functions. An input of these functions is two things: the x
and the series of natural numbers 1, 2, ...
. We're mapping some complex function to each element of the series, then we're reducing new series to a single value with a help of function +
.
Second expressions geves us an example of imperative calculation. At least we can see here separate steps of calculating.
An exciting introduction to the functional programming you can find in the book Structure and Interpretation of Computer Programs.