DEV Community

Discussion on: Loops are bad, algorithms are good! Aren't they?

Collapse
 
sandordargo profile image
Sandor Dargo

Thanks for your comment, Iven. That's an interesting point. While you can definitely use fold like standard functions in C++ (such as accumulate) those are not the only ones to achieve a more functional style than the conventional way.

This is C++, we don't speak about pure functional programming, but a more functional style.

As I see it there are different levels of FP. One is that If you use functions without side effects, functions that produce always the same output given the same input, functions that are pure you are already a few steps ahead. If you use the C++ STL extensively you are on the right path of FP.

By the way, it's funny that it was created by someone who doesn't like OOP, but is rather an advocate for FP and generic programming. How funny is that he made such an enourmous contribution to "C with classes".

Thanks again for your comment.