Functional Programming in Modern C++: The Imperatives Must Go!
summary
Argues that functional programming is already inside modern C++ and demonstrates concrete techniques: std::optional and std::expected with monadic bind/and_then, a fmap via std::transform pattern and a lift macro for picking overloads, plus lazy composition using C++20 ranges and views. Shows a real counting trick implemented with zip/tail then inner_product, contrasts a 6-line shell pipeline with verbose imperative C++, and warns about dangling views, compile-time cost and when to prefer imperative code for performance or easier debugging.
AI-written summary · about
chapters (13)
- 0:00Welcome
- 1:48What is functional programming
- 8:14History of functional programming
- 13:14Why FP matters
- 20:22Easy FP patterns in C++
- 25:42Working with optional
- 36:21Chaining operations with lifting
- 41:46Monadic continuations with optional
- 51:04Error handling with expected
- 58:40C++20 ranges for declarative code
- 1:09:21Word frequency problem
- 1:13:19Trade-offs and debugging
- 1:25:34Q&A
related talks
46mPractical Functional Programming in C++
49m“Applying functional programming in code design"
44mFunctional Programming You Already Know
01h 02mFunctional C++
01h 47mFunctional C++
01h 09mThe Definitive Guide to Functional Programming in Cpp
58mFunctional Programming with C#
49mThe Evolution of Functional Programming in C++
