Another important thing that functional programming encourage is function composition. Even the most simple function can be useful if you combine it with something else.
This is one example that I really like. Say that you have this function.
functionidentity(arg){returnarg;}
It may seen useless but if you have map function that works like Array.map but for "plain" objects, you could implement a shallow_copy function like this.
Another important thing that functional programming encourage is function composition. Even the most simple function can be useful if you combine it with something else.
This is one example that I really like. Say that you have this function.
It may seen useless but if you have
map
function that works likeArray.map
but for "plain" objects, you could implement ashallow_copy
function like this.Yes, this is a nice example, I agree. And i will explain more about this, in the next posts