Reduce: From functional programming to C++17 Fold expressions
In its simplest form, reduce turns into summing the contents of a sequence but in functional programming, refers to a family of higher-order functions that can, among others, easily implement mapping and filtering and express the process of stepping through an iterable and apply a combination function. In this talk we present the concepts behind reduce using Haskell and Python and check the ways we've always had in C++ to express the same ideas. A brief mention of transducers and the analysis of their compositional power then follows. A presentation of C++17 "Folds" is given, packed with example applications from template meta-programming and generic programming. We demonstrate how boost.reduce implements fold expressions for any binary operators and elaborate on compile time computation, expression templates and lazy evaluation.
Speaker: Nikos Athanasiou