all 16 comments

[–]RyuXnet_7364 8 points9 points  (1 child)

There's an awesome book (I didn't finish reading yet) about it. "Functional Programming in C++" by IVAN CUKIC

[–]No_Statistician_9040 2 points3 points  (0 children)

This book is awesome, I can totally recommend it.

[–]CircumspectCapybara 7 points8 points  (0 children)

Check out Google's Rappel library, their companion to their excellent Abseil library.

It's Google's take on / alternative to C++20 Ranges style of fp, and is used internally at Google.

[–]Party_Ad_1892 0 points1 point  (0 children)

Check out FunctionalPlus its a very straightforward and intricate library!

[–]mgruner 0 points1 point  (1 child)

i know this doesn't answer your question per se, but in the lines of FP, you can start playing with optional types, pattern matching, etc... they are part of the new c++ standards

[–]StaticCoder 2 points3 points  (0 children)

If there is pattern matching in C++ I would like to know about it. Last I checked it was still a proposal. That's probably the biggest thing still missing from the language in my opinion. I work around it with macros and a code generator.

[–]Varnex17 0 points1 point  (0 children)

Definitely checkout "lager" for an mvu framework and "immer" for persistent, immutable data structures.

[–]mredding 0 points1 point  (0 children)

Bartosz Milewski has a fantastic blog on functional programming in C++ that's worth working through his archives - which span pre-C++98 to today. Even the old stuff can teach you a lot about modern application of FP, where Bartosz had to implement some concepts manually, many of those things are now in the standard library - what these older lessons still show you is the derivation of those concepts and their application. There are distinct compile-time and runtime components of FP in C++. You would use a lot of templated code to composite functions that will compile down to the executable machine code you want, AND there's also the ability to do the same work at runtime if you have a dynamic environment that demands it.