Full Download Beginning Functional JavaScript: Uncover the Concepts of Functional Programming with EcmaScript 8 2nd Edition Srikanth Machiraju PDF DOCX
Full Download Beginning Functional JavaScript: Uncover the Concepts of Functional Programming with EcmaScript 8 2nd Edition Srikanth Machiraju PDF DOCX
com
https://textbookfull.com/product/beginning-functional-
javascript-uncover-the-concepts-of-functional-programming-
with-ecmascript-8-2nd-edition-srikanth-machiraju/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/functional-and-concurrent-
programming-core-concepts-and-features-1st-edition-charpentier/
textboxfull.com
https://textbookfull.com/product/mathematica-functional-and-
procedural-programming-2nd-edition-v-aladjev/
textboxfull.com
https://textbookfull.com/product/get-programming-with-javascript-next-
new-features-of-ecmascript-2015-2016-and-beyond-1st-edition-jd-
isaacks/
textboxfull.com
https://textbookfull.com/product/web-applications-with-elm-functional-
programming-for-the-web-1st-edition-wolfgang-loder/
textboxfull.com
Contents
1. Cover
2. Front Matter
3. 1. Functional Programming in Simple Terms
4. 2. Fundamentals of JavaScript Functions
5. 3. Higher Order Functions
6. 4. Closures and Higher Order Functions
7. 5. Being Functional on Arrays
8. 6. Currying and Partial Application
9. 7. Composition and Pipelines
10. 8. Fun with Functors
11. 9. Monads in Depth
12. 10. Pause, Resume, and Async with Generators
13. 11. Building a React-Like Library
14. 12. Testing and Closing Thoughts
15. Back Matter
Landmarks
1. Cover
2. Table of Contents
3. Body Matter
Anto Aravinth and Srikanth Machiraju
Srikanth Machiraju
Hyderabad, Andhra Pradesh, India
—Anto Aravinth
—Srikanth Machiraju
TABLE OF CONTENTS
Chapter 1: Functional Programming in Simple Terms
What Is Functional Programming? Why Does It Matter?
Referential Transparency
Imperative, Declarative, Abstraction
Functional Programming Benefits
Pure Functions
Pure Functions Lead to Testable Code
Reasonable Code
Parallel Code
Cachable
Pipelines and Composable
A Pure Function Is a Mathematical Function
What We Are Going to Build
Is JavaScript a Functional Programming Language?
Summary
Chapter 2: Fundamentals of JavaScript Functions
ECMAScript: A Bit of History
Creating and Executing Functions
First Function
Strict Mode
Return Statement Is Optional
Multiple Statement Functions
Function Arguments
ES5 Functions Are Valid in ES6 and Above
Setting Up Our Project
Initial Setup
Our First Functional Approach to the Loop Problem
Gist on Exports
Gist on Imports
Running the Code Using Babel-Node
Creating Script in Npm
Running the Source Code from Git
Summary
Chapter 3: Higher Order Functions
Understanding Data
Understanding JavaScript Data Types
Storing a Function
Passing a Function
Returning a Function
Abstraction and Higher Order Functions
Abstraction Definitions
Abstraction via Higher Order Functions
Higher Order Functions in the Real World
every Function
some Function
sort Function
Summary
Chapter 4: Closures and Higher Order Functions
Understanding Closures
What Are Closures?
Remembering Where It Is Born
Revisiting sortBy Function
Higher Order Functions in the Real World (Continued)
tap Function
unary Function
once Function
memoize Function
assign function
Summary
Chapter 5: Being Functional on Arrays
Working Functionally on Arrays
map
filter
Chaining Operations
concatAll
Reducing Function
reduce Function
Zipping Arrays
zip Function
Summary
Chapter 6: Currying and Partial Application
A Few Notes on Terminology
Unary Function
Binary Function
Variadic Functions
Currying
Currying Use Cases
A logger Function: Using Currying
Revisit Curry
Back to logger Function
Currying in Action
Finding a Number in Array Contents
Squaring an Array
Data Flow
Partial Application
Implementing partial Function
Currying vs. Partial Application
Summary
Chapter 7: Composition and Pipelines
Composition in General Terms
Unix Philosophy
Functional Composition
Revisiting map,filter
compose Function
Playing with the compose Function
curry and partial to the Rescue
compose Many Functions
Pipelines and Sequence
Implementing pipe
Odds on Composition
The Pipeline Operator
Debugging Using the tap Function
Summary
Chapter 8: Fun with Functors
What Is a Functor?
Functor Is a Container
Implementing map
MayBe
Implementing MayBe
Simple Use Cases
Real-World Use Cases
Either Functor
Implementing Either
Reddit Example Either Version
Word of Caution: Pointed Functor
Summary
Chapter 9: Monads in Depth
Getting Reddit Comments for Our Search Query
The Problem
Implementation of the First Step
Merging Reddit Calls
Problem of Nested/Many maps
Solving the Problem via join
join Implementation
chain Implementation
Summary
Chapter 10: Pause, Resume, and Async with Generators
Async Code and Its Problem
Callback Hell
Generators 101
Creating Generators
Caveats of Generators
yield Keyword
done Property of Generator
Passing Data to Generators
Using Generators to Handle Async Calls
Generators for Async: A Simple Case
Generators for Async: A Real-World Case
Async Functions in ECMAScript 2017
Promise
Await
Async
Chaining Callbacks
Error Handling in Async Calls
Async Functions Transpiled to Generators
Summary
Chapter 11: Building a React-Like Library
Immutability
Building a Simple Redux Library
Building a Framework Like HyperApp
Virtual DOM
JSX
JS Fiddle
CreateActions
Render
Patch
Update
Merge
Remove
Summary
Chapter 12: Testing and Closing Thoughts
Introduction
Types of Testing
BDD and TDD
JavaScript Test Frameworks
Testing Using Mocha
Mocking Using Sinon
Testing with Jasmine
Code Coverage
Linting
Unit Testing Library Code
Closing Thoughts
Summary
Index
ABOUT THE AUTHORS AND ABOUT THE
TECHNICAL REVIEWER
Srikanth Machiraju
1. Functional Programming in
Simple Terms
Anto Aravinth1 and Srikanth Machiraju2
(1) Chennai, Tamil Nadu, India
(2) Hyderabad, Andhra Pradesh, India
var percentValue = 5;
var calculateTax = (value) => { return
value/100 * (100 + percentValue) }
Rewritten calculateTax
Listing 1-2
Function
Referential Transparency
With our definition of function, we have made a statement that all
the functions are going to return the same value for the same
input. This property of a function is called a referential
transparency . A simple example is shown in Listing 1-5.
Referential Transparency
Listing 1-5
Example
In Listing 1-5, we have defined a simple function called
identity. This function is going to return whatever you’re
passing as its input; that is, if you’re passing 5, it’s going to return
the value 5 (i.e., the function just acts as a mirror or identity).
Note that our function operates only on the incoming argument i,
and there is no global reference inside our function (remember in
Listing 1-2, we removed percentValue from global access and
made it an incoming argument). This function satisfies the
conditions of a referential transparency. Now imagine this
function is used between other function calls like this:
sum(4,5) + identity(1)
With our referential transparency definition, we can convert
that statement into this:
sum(4,5) + 1
REFERENTIAL TRANSPARENCY IS A
PHILOSOPHY
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com