Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning C++ Functional Programming

You're reading from   Learning C++ Functional Programming Explore functional C++ with concepts like currying, metaprogramming and more

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher
ISBN-13 9781787281974
Length 304 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Wisnu Anggoro Wisnu Anggoro
Author Profile Icon Wisnu Anggoro
Wisnu Anggoro
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Diving into Modern C++ 2. Manipulating Functions in Functional Programming FREE CHAPTER 3. Applying Immutable State to the Function 4. Repeating Method Invocation Using Recursive Algorithm 5. Procrastinating the Execution Process Using Lazy Evaluation 6. Optimizing Code with Metaprogramming 7. Running Parallel Execution Using Concurrency 8. Creating and Debugging Application in Functional Approach

What this book covers

Chapter 1, Diving into Modern C++, provides an overview of modern C++, including the implementation of several new features in modern C++, such as the auto keyword, decltype keyword, null pointer, range-based for loop, standard template library, Lambda expressions, smart pointer, and tuple.

Chapter 2, Manipulating Functions in Functional Programming, covers the essential techniques in functional programming to manipulate a function; they are the first-class function technique, pure function, and currying technique. By applying the first-class function, we can treat our function as a data, which means it can be assigned to any variable instead of only being invoked as function. We also will apply the pure function technique so the function won't produce the side effect anymore. Moreover, to simplify the function, we can apply currying techniques, which will reduce the multiple arguments function by evaluating a sequence of functions with a single argument in each function.

Chapter 3, Applying Immutable State to the Function, explains how we implement the immutable object for the mutable object. We will also delve into first-class functions and pure functions, which we discussed in the previous chapter, to produce an immutable object.

Chapter 4, Repeating Method Invocation Using Recursive Algorithm, discusses the difference between iteration and recursion and why recursion techniques are better for functional programming. We will also enumerate the three kinds of recursion: functional, procedural, and backtracking recursion.

Chapter 5, Procrastinating the Execution Process Using Lazy Evaluation, explains how to delay the process of execution to get more efficient code. We will also implement caching and memoization techniques to make our code run faster.

Chapter 6, Optimizing Code with Metaprogramming, talks about running code with compile-time execution by using metaprogramming to optimize code. We will also discuss how to refactor flow control into template metaprogramming.

Chapter 7, Running Parallel Execution Using Concurrency, walks us through running multiple threads in C++ programming, as well as synchronizing threads to avoid deadlocks. We will also apply thread processing in a Windows operating system.

Chapter 8, Creating and Debugging Application in Functional Approach, elaborates all the techniques we discussed in the previous chapters to design a functional programming. Also, we will try to debug code to find a solution if there are unexpected results or the program crashes in the middle of execution.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime