Functional Programming in JavaScript 1st Edition by Dan Mantyla ISBN 1784398225 9781784398224 pdf download
Functional Programming in JavaScript 1st Edition by Dan Mantyla ISBN 1784398225 9781784398224 pdf download
https://ebookball.com/product/functional-programming-in-
javascript-1st-edition-by-dan-mantyla-
isbn-1784398225-9781784398224-20230/
https://ebookball.com/product/functional-programming-in-c-1st-edition-
by-enrico-buonanno-isbn-9781638354048-1638354049-15788/
https://ebookball.com/product/programming-javascript-applications-1st-
edition-by-eric-elliott-1491950250-9781491950258-20264/
https://ebookball.com/product/javascript-mini-faq-1st-edition-by-
danny-goodman-isbn-11420/
Functional Occlusion in Restorative Dentistry and
Prosthodontics 1st Edition by Iven Klineberg, Steven
Eckert ISBN 072343879X 9780723438793
https://ebookball.com/product/functional-occlusion-in-restorative-
dentistry-and-prosthodontics-1st-edition-by-iven-klineberg-steven-
eckert-isbn-072343879x-9780723438793-5506/
https://ebookball.com/product/javascript-and-node-fundamentals-1st-
edition-by-azat-mardan-isbn-b00hdyhkn6-13414/
https://ebookball.com/product/advanced-javascript-2nd-edition-by-
chuck-easttom-isbn-155622852x-9781556228520-13370/
https://ebookball.com/product/jquery-and-javascript-phrasebook-1st-
edition-by-brad-dayley-isbn-0133410854-9780133410853-12804/
Functional Programming in
JavaScript
Table of Contents
Functional Programming in JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. The Powers of JavaScript's Functional Side – a Demonstration
Introduction
The demonstration
The application – an e-commerce website
Imperative methods
Functional programming
Summary
2. Fundamentals of Functional Programming
Functional programming languages
What makes a language functional?
Advantages
Cleaner code
Modularity
Reusability
Reduced coupling
Mathematically correct
Functional programming in a nonfunctional world
Is JavaScript a functional programming language?
Working with functions
Self-invoking functions and closures
Higher-order functions
Pure functions
Anonymous functions
Method chains
Recursion
Divide and conquer
Lazy evaluation
The functional programmer's toolkit
Callbacks
Array.prototype.map()
Array.prototype.filter()
Array.prototype.reduce()
Honorable mentions
Array.prototype.forEach
Array.prototype.concat
Array.prototype.reverse
Array.prototype.sort
Array.prototype.every and Array.prototype.some
Summary
3. Setting Up the Functional Programming Environment
Introduction
Functional libraries for JavaScript
Underscore.js
Fantasy Land
Bilby.js
Lazy.js
Bacon.js
Honorable mentions
Development and production environments
Browsers
Server-side JavaScript
A functional use case in the server-side environment
CLI
Using functional libraries with other JavaScript modules
Functional languages that compile into JavaScript
Summary
4. Implementing Functional Programming Techniques in JavaScript
Partial function application and currying
Function manipulation
Apply, call, and the this keyword
Binding arguments
Function factories
Partial application
Partial application from the left
Partial application from the right
Currying
Function composition
Compose
Sequence – compose in reverse
Compositions versus chains
Programming with compose
Mostly functional programming
Handling events
Functional reactive programming
Reactivity
Putting it all together
Summary
5. Category Theory
Category theory
Category theory in a nutshell
Type safety
Object identities
Functors
Creating functors
Arrays and functors
Function compositions, revisited
Monads
Maybes
Promises
Lenses
jQuery is a monad
Implementing categories
Summary
6. Advanced Topics and Pitfalls in JavaScript
Recursion
Tail recursion
The Tail-call elimination
Trampolining
The Y-combinator
Memoization
Variable scope
Scope resolutions
Global scope
Local scope
Object properties
Closures
Gotchas
Function declarations versus function expressions versus the
function constructor
Function declarations
Function expressions
The function constructor
Unpredictable behavior
Summary
7. Functional and Object-oriented Programming in JavaScript
JavaScript – the multi-paradigm language
JavaScript's object-oriented implementation – using prototypes
Inheritance
JavaScript's prototype chain
Inheritance in JavaScript and the Object.create() method
Mixing functional and object-oriented programming in JavaScript
Functional inheritance
Strategy Pattern
Mixins
Classical mixins
Functional mixins
Summary
A. Common Functions for Functional Programming in JavaScript
B. Glossary of Terms
Index
Functional Programming in
JavaScript
Functional Programming in
JavaScript
Copyright © 2015 Packt Publishing
Every effort has been made in the preparation of this book to ensure
the accuracy of the information presented. However, the information
contained in this book is sold without warranty, either express or
implied. Neither the author nor Packt Publishing, and its dealers and
distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK
ISBN 978-1-78439-822-4
www.packtpub.com
Dan Mantyla
Reviewers
Dom Derrien
Joe Dorocak
Peter Ehrlich
Commissioning Editor
Julian Ursell
Acquisition Editor
Owen Roberts
Kirti Patil
Technical Editor
Abhishek R. Kotian
Copy Editors
Aditya Nair
Aarti Saldanha
Vikrant Phadkey
Project Coordinator
Nidhi Joshi
Proofreaders
Stephen Copestake
Maria Gould
Paul Hindle
Indexer
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Dan Mantyla works as a web application developer for the
University of Kansas. He enjoys contributing to open source web
frameworks and wrenching on motorcycles. Dan is currently living in
Lawrence, Kansas, USA—the birthplace of Python Django and home
to Linux News Media.
Dan has also clicked the cover image, which was taken outside his
home in Lawrence, Kansas, USA, where the sunflower fields are in
bloom for only one short week in September.
About the Reviewers
Dom Derrien is a full stack web developer who has recently been
defining application environments with a focus on high availability
and scalability. He's been in the development field for more than 15
years and has worked for big and small companies and as an
entrepreneur.
I want to thank my wife, Sophie, and our sons, Erwan and Goulven,
with whom I enjoy a peaceful life in Montréal, Québec, Canada.
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.
ebookball.com