For functional thinking we mean that we will change our way of programming. No more imperatively, that is, program line after line, command after command expressing orders. We will program a more optimal way, so functional.
The first important point is to understand that in functional programming variables do not vary. They never change value.
There are many languages that are functional. As this is our first step I chose to use Clojure.
I will install Clojure to start playing with this concept.
This post is intended for you who like me is beginning to understand this new world.
Access the link below and perform the installation in your environment:
http://clojure.org/guides/getting_started
The second important point is understand the basic of syntax! All in this new world is functions, for we start to developer we need know it. (function params… )
Importante things to now about functional programming :
- Variables never change the values ;
- Syntax always will be ( function paramOne paramTwo … ) for example.
- Functions can call functions;
- Functions always will be the same, after you define you can’t change. Example f(x) = x +1 always when you call f(x) be x + 1 ;
- A function always return a value;
- A function can receive a function as parameter.