I have been enthused with functional programming recently. As C++ is my favourite language (or most familiar language), I have also tried to implement in C++ some of the techniques I learnt. And this blog serves to record my learning experience. It is my sincere hope that it will be useful to other people that come to functional programming with an imperative programming background.
Without further ado, let me describe first what I wanted to implement:
If you are not familiar with these concepts, do not worry, as I will show you the code in both C++ and some ‘more functional’ languages. The functional language implementations are always easy to understand, even if you do not know the languages!
The concept of the
map function is quite simple: it applies the function parameter to each item in a list parameter, and return the result as a list. The following…
View original post 961 more words