What is Functional Programming?
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.
composing pure functions, avoiding shared state, mutable data, and side-effects.
- Easier to determine inputs.
- Easier to determine outputs.
- Easier to demonstrate and prove you have a correct program.
- Easier to test programs too difficult to prove.
Why is functional programming so great?
If you try to perform with memory efficiency and logic at the same time, the problem is that you may create hidden side effects which cause a lot of bugs. Thus, the idea in functional programming of keeping functions small, pure, and composable doing one thing at a time and doing it well this idea of immutability the idea that functions that take inputs and output. So the function can be used with other functions. It allows us to have a predictable program where it minimizes bugs.