Movatterモバイル変換


[0]ホーム

URL:


Packt
Search iconClose icon
Search icon CANCEL
Subscription
0
Cart icon
Your Cart(0 item)
Close icon
You have no products in your basket yet
Save more on your purchases!discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Profile icon
Account
Close icon

Change country

Modal Close icon
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timerSALE ENDS IN
0Days
:
00Hours
:
00Minutes
:
00Seconds
Home> Programming> Functional Programming> Learning C++ Functional Programming
Learning C++ Functional Programming
Learning C++ Functional Programming

Learning C++ Functional Programming: Explore functional C++ with concepts like currying, metaprogramming and more

Arrow left icon
Profile Icon Wisnu Anggoro
Arrow right icon
₹700₹3276.99
Full star iconFull star iconFull star iconEmpty star iconEmpty star icon3(5 Ratings)
eBookAug 2017304 pages1st Edition
eBook
₹700 ₹3276.99
Paperback
₹4096.99
Subscription
Free Trial
Renews at ₹800p/m
eBook
₹700 ₹3276.99
Paperback
₹4096.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Table of content iconView table of contentsPreview book icon Preview Book

Learning C++ Functional Programming

Manipulating Functions in Functional Programming

In the previous chapter, we talked about modern C++ in depth, especially about the new feature in C++11--the Lambda expression. As we discussed earlier, the Lambda expression is useful in simplifying function notation. Thus, in this chapter, we will apply the power of the Lambda expression again, which will be used in functional code, especially when we talk about currying--the technique to split and reduce the current function.

In this chapter, we will discuss the following topics:

  • Applying the first-class function and higher-order function so that our functions can not only be invoked as a function, but also be assigned to any variable, pass a function, and return a function
  • Pure function, to avoid side effect in our function since it no longer contacts an outside state
  • Currying, as mentioned at the beginning of this chapter...

Getting acquainted with three functional techniques in the higher-order function

We discussed that in the first-class function, the C++ language treats the functions as the value, which means we can pass them to the other functions, assign to variables, and so on. However, we have another term in functional programming, that is, a higher-order function, which are functions that work on other functions. It means thehigher-order function can pass functions as the argument and can also return a function.

The higher-order function concept can be applied to the function in general, like in a mathematical function, instead of the first-class function concept that can only be applied in the functional programming language. Now, let's examine the three most useful higher-order functions in functional programming--map,filter, andfold.

...

Summary

We have discussed that there are some techniques to manipulate a function. We will gain many advantages from it. Since we can implement the first-class function in the C++ language, we can pass a function as another function's parameter. We can treat a function as a data object so we can assign it to a variable and store it in the container. Also, we can compose a new function from the existing one. Moreover, by using map, filter, and fold, we can implement the higher-order function in every function we create.

Another technique we have to implement in gaining a better functional code is a pure function to avoid a side effect. We can refactor all the functions we have so it won't talk to outside variables or states and won't change and retrieve the value from the outside state. Also, to reduce the multiple arguments function so we can evaluate its sequence...

Key benefits

  • Modularize your applications and make them highly reusable and testable
  • Get familiar with complex concepts such as metaprogramming, concurrency, and immutability
  • A highly practical guide to building functional code in C++ filled with lots of examples and real-world use cases

Description

Functional programming allows developers to divide programs into smaller, reusable components that ease the creation, testing, and maintenance of software as a whole. Combined with the power of C++, you can develop robust and scalable applications that fulfill modern day software requirements. This book will help you discover all the C++ 17 features that can be applied to build software in a functional way.The book is divided into three modules—the first introduces the fundamentals of functional programming and how it is supported by modern C++. The second module explains how to efficiently implement C++ features such as pure functions and immutable states to build robust applications. The last module describes how to achieve concurrency and apply design patterns to enhance your application’s performance. Here, you will also learn to optimize code using metaprogramming in a functional way.By the end of the book, you will be familiar with the functional approach of programming and will be able to use these techniques on a daily basis.

Who is this book for?

This book is for C++ developers comfortable with OOP who are interested in learning how to apply the functional paradigm to create robust and testable apps.

What you will learn

  • • Get to know the difference between imperative and functional approaches
  • • See the use of first-class functions and pure functions in a functional style
  • • Discover various techniques to apply immutable state to avoid side effects
  • • Design a recursive algorithm effectively
  • • Create faster programs using lazy evaluation
  • • Structure code using design patterns to make the design process easier
  • • Use concurrency techniques to develop responsive software
  • • Learn how to use the C++ Standard Template Library and metaprogramming in a functional way to improve code optimization

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Languages :

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Product Details

Publication date :Aug 10, 2017
Length:304 pages
Edition :1st
Language :English
ISBN-13 :9781787280588
Vendor :
Microsoft
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800billed monthly
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconSimple pricing, no contract
₹4500billed annually
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick iconExclusive print discounts
₹5000billed in 18 months
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick iconExclusive print discounts

Frequently bought together


Modern C++ Programming Cookbook
Modern C++ Programming Cookbook
Read more
May 2017590 pages
Full star icon4 (7)
eBook
eBook
₹700₹3276.99
₹4096.99
Learning C++ Functional Programming
Learning C++ Functional Programming
Read more
Aug 2017304 pages
Full star icon3 (5)
eBook
eBook
₹700₹3276.99
₹4096.99
Mastering C++ Multithreading
Mastering C++ Multithreading
Read more
Jul 2017244 pages
Full star icon3.1 (12)
eBook
eBook
₹700₹2919.99
₹3649.99
Stars icon
Total11,843.97
Modern C++ Programming Cookbook
₹4096.99
Learning C++ Functional Programming
₹4096.99
Mastering C++ Multithreading
₹3649.99
Total11,843.97Stars icon
Buy 2+ to unlock₹600 prices - master what's next.
SHOP NOW

Table of Contents

8 Chapters
Diving into Modern C++Chevron down iconChevron up icon
Diving into Modern C++
Getting closer with several new features in modern C++
Leveraging the use of C++ language with the C++ Standard Libraries
Simplifying the function notation using a Lambda expression
Avoiding manual memory management with smart pointers
Storing many different data types using tuples
Summary
Manipulating Functions in Functional ProgrammingChevron down iconChevron up icon
Manipulating Functions in Functional Programming
Applying the first-class function in all functions
Getting acquainted with three functional techniques in the higher-order function
Avoiding the side effect with pure function
Reducing a multiple arguments function with currying
Summary
Applying Immutable State to the FunctionChevron down iconChevron up icon
Applying Immutable State to the Function
Understanding the essential part from immutable object
Preventing the modification of a value
Applying the first-class function and the pure function to the immutable object
Developing the immutable object
Enumerating the benefits of being immutable
Summary
Repeating Method Invocation Using Recursive AlgorithmChevron down iconChevron up icon
Repeating Method Invocation Using Recursive Algorithm
Repeating the function invocation recursively
Recurring the immutable function
Getting closer to tail recursion
Getting acquainted with functional, procedural, and backtracking recursion
Summary
Procrastinating the Execution Process Using Lazy EvaluationChevron down iconChevron up icon
Procrastinating the Execution Process Using Lazy Evaluation
Evaluating the expression
The basic concept of lazy evaluation
Lazy evaluation in action
Summary
Optimizing Code with MetaprogrammingChevron down iconChevron up icon
Optimizing Code with Metaprogramming
Introduction to metaprogramming
Building the template metaprogramming
Selecting a type in compile-time
Flow control with template metaprogramming
Executing the code in compile-time
Benefits and drawbacks of metaprogramming
Summary
Running Parallel Execution Using ConcurrencyChevron down iconChevron up icon
Running Parallel Execution Using Concurrency
Concurrency in C++
Synchronizing the threads using mutex
Understanding the thread processing in a Windows operating system
Summary
Creating and Debugging Application in Functional ApproachChevron down iconChevron up icon
Creating and Debugging Application in Functional Approach
Preparing an imperative class
Refactoring the imperative class to become a functional class
Debugging the code
Summary

Recommendations for you

Left arrow icon
Debunking C++ Myths
Debunking C++ Myths
Read more
Dec 2024226 pages
Full star icon5 (1)
eBook
eBook
₹700₹2382.99
₹2978.99
Go Recipes for Developers
Go Recipes for Developers
Read more
Dec 2024350 pages
eBook
eBook
₹700₹2382.99
₹2978.99
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (64)
eBook
eBook
₹700₹2978.99
₹3723.99
₹3723.99
Asynchronous Programming with C++
Asynchronous Programming with C++
Read more
Nov 2024424 pages
Full star icon5 (1)
eBook
eBook
₹700₹2502.99
₹3127.99
Modern CMake for C++
Modern CMake for C++
Read more
May 2024504 pages
Full star icon4.7 (13)
eBook
eBook
₹700₹2978.99
₹3723.99
Learn Python Programming
Learn Python Programming
Read more
Nov 2024616 pages
Full star icon3.5 (2)
eBook
eBook
₹700₹2382.99
₹2978.99
Learn to Code with Rust
Learn to Code with Rust
Read more
Sep 202557hrs 40mins
Full star icon5 (1)
Video
Video
₹700₹5585.99
Modern Python Cookbook
Modern Python Cookbook
Read more
Jul 2024818 pages
Full star icon4.9 (17)
eBook
eBook
₹700₹3276.99
₹4096.99
Right arrow icon

Customer reviews

Rating distribution
Full star iconFull star iconFull star iconEmpty star iconEmpty star icon3
(5 Ratings)
5 star0%
4 star40%
3 star40%
2 star0%
1 star20%
MikeJan 05, 2018
Full star iconFull star iconFull star iconFull star iconEmpty star icon4
The grammar issue is bad but the author still manages to make himself understood. The content is decent but not worth the price.
Amazon Verified reviewAmazon
John CarterSep 21, 2018
Full star iconFull star iconFull star iconFull star iconEmpty star icon4
Very difficult to get to get to grips with initially but gets easier as you go.
Amazon Verified reviewAmazon
Hangzhou TangMay 31, 2018
Full star iconFull star iconFull star iconEmpty star iconEmpty star icon3
It's not as perfect as I assume before. I found an error even in the beginning of the book. For example in page 11, the book shows "auto main ->int" which should be "auto main() -> int".
Amazon Verified reviewAmazon
JonathanApr 22, 2018
Full star iconFull star iconFull star iconEmpty star iconEmpty star icon3
Grammar is terrible. Code snippets are duplicated over and over again - concepts that can be shown in one or two lines are surrounded by 20 lines of boilerplate.Coming from functional programming languages, I was excited for what might be possible in c++ but was disappointed by the lack of depth in the book. I don't know enough about c++ to say that's the author's fault or the language's.
Amazon Verified reviewAmazon
Mr. MooMay 09, 2018
Full star iconEmpty star iconEmpty star iconEmpty star iconEmpty star icon1
I have quite a few Packt Publishing titles in my library and normally they are well written, concise and informative, but this is certainly not the case for this book, and to be honest the quality and content is shocking. As has been said in other reviews the grammar is terrible and the repetition of the example code a complete waste of space. But the book's does not live up to it's hype!From the back of the book “This book will help you discover all the C++17 features that can be applied to build software in a functional way.”, I read this and based my purchase decision on it, all very well you might think. But inside the book on page 40 there is the following paragraph:“The C++17 language plans to introduce two new features for the Lambda expression—they are capturing *this, which allows the expression to capture the enclosing object by copy, and the constexpr Lambda expressions, which allows us to use the result of the Lambda expressions and generate constexpr objects at compile time. However, since C++17 has not been released yet, we cannot try it for now.”Considering the quote above the book’s obviously been rushed to print and written prior to the availability of a C++ 17 compiler, so why Packt used the blurb they did I do not understand when they and the author clearly couldn’t produce what the back cover was offering.If I were you I’d keep your money and buy something else and if you want to know more about Functional programming with C++ there are plenty of articles available for free on the internet.
Amazon Verified reviewAmazon

People who bought this also bought

Left arrow icon
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (64)
eBook
eBook
₹700₹2978.99
₹3723.99
₹3723.99
Event-Driven Architecture in Golang
Event-Driven Architecture in Golang
Read more
Nov 2022384 pages
Full star icon4.9 (10)
eBook
eBook
₹700₹2978.99
₹3723.99
₹3351.99
The Python Workshop Second Edition
The Python Workshop Second Edition
Read more
Nov 2022600 pages
Full star icon4.6 (19)
eBook
eBook
₹700₹3562.99
₹3872.99
Template Metaprogramming with C++
Template Metaprogramming with C++
Read more
Aug 2022480 pages
Full star icon4.6 (13)
eBook
eBook
₹700₹3220.99
₹3500.99
Domain-Driven Design with Golang
Domain-Driven Design with Golang
Read more
Dec 2022204 pages
Full star icon4.4 (18)
eBook
eBook
₹700₹2680.99
₹3351.99
Right arrow icon

About the author

Profile icon Wisnu Anggoro
Wisnu Anggoro
Wisnu Anggoro is a Microsoft Certified Professional in C# programming and an experienced C/C++ developer. He has also authored the books Boost.Asio C++ Network Programming - Second Edition and Functional C# by Packt. He has been programming since he was in junior high school, which was about 20 years ago, and started developing computer applications using the BASIC programming language in the MS-DOS environment. He has solid experience in smart card programming, as well as desktop and web application programming, including designing, developing, and supporting the use of applications for SIM Card Operating System Porting, personalization, PC/SC communication, and other smart card applications that require the use of C# and C/C++. He is currently a senior smart card software engineer at CIPTA, an Indonesian company that specializes in innovation and technology for smart cards. He can be reached through his email at wisnu@anggoro.net
Read more
See other products by Wisnu Anggoro
Getfree access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook?Chevron down iconChevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website?Chevron down iconChevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook?Chevron down iconChevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support?Chevron down iconChevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks?Chevron down iconChevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook?Chevron down iconChevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Create a Free Account To Continue Reading

Modal Close icon
OR
    First name is required.
    Last name is required.

The Password should contain at least :

  • 8 characters
  • 1 uppercase
  • 1 number
Notify me about special offers, personalized product recommendations, and learning tips By signing up for the free trial you will receive emails related to this service, you can unsubscribe at any time
By clicking ‘Create Account’, you are agreeing to ourPrivacy Policy andTerms & Conditions
Already have an account? SIGN IN

Sign in to activate your 7-day free access

Modal Close icon
OR
By redeeming the free trial you will receive emails related to this service, you can unsubscribe at any time.

[8]ページ先頭

©2009-2025 Movatter.jp