Hands-on functional programming with C++ : an effective guide to writing accelerated functional code using C++17 and C++20 /
Questions; Chapter 5: Partial Application and Currying; Technical requirements; Partial application and currying; Partial application; Partial application in C++; Partial application on class methods; Currying; What is currying?; Currying and partial application; Currying functions with multiple arg...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing, Limited,
2019.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover; Title Page; Copyright and Credits; Dedication; About Packt; Contributors; Table of Contents; Preface; Section 1: Functional Building Blocks in C++; Chapter 1: An Introduction to Functional Programming; Technical requirements; An introduction to functional programming; Functional programming constructs are everywhere; Structured loops versus functional loops; Immutability; OOP versus functional design styles; Composability and removing duplication; Summary; Questions; Chapter 2: Understanding Pure Functions; Technical requirements; What is a pure function?; Pure functions in C++
- Pure functions without argumentsPure functions with one or more arguments; Pure functions and immutability; Immutability and passing by reference; Immutability and pointers; Immutability and non-class functions; Immutability and output parameters; Aren't static functions bad practice?; Alternatives to static functions; Pure functions and I/O; Summary; Questions; Chapter 3: Deep Dive into Lambdas; Technical requirements; What is a lambda?; Lambdas in C++; Capturing variables; Capturing variables by value and by reference; Capturing multiple values; Capturing pointer values
- What capture should we use?Lambdas and pure functions; Lambda immutability and pass by value arguments; Lambda immutability and pass by reference arguments; Lambda immutability and pointer arguments; Lambdas and I/O; Lambda immutability and capturing values; Immutability for values captured by reference; Immutability for pointers captured by value; Immutability for pointers captured by reference; Lambdas and classes; Lambdas as data members; Lambdas as static variables; Converting a static function to a lambda; Lambdas and coupling; Summary; Questions
- Chapter 4: The Idea of Functional CompositionTechnical requirements; What is functional composition?; Functional composition; Implementing functional composition in C++; Functional composition is not commutative; Complex functional composition; Implementing more compose functions; Decomposing functions with multiple arguments; Incrementing the result of multiplication; Multiplying increments; Reflections on the composition and decomposition of functions; Using functional composition to remove duplication; Generalizing incrementResultOfMultiplication; Generalizing multiplyIncrementedValues