Introducing Functional Programming with Underscore.js
(O’Reilly – paperback, Kindle)
“This book,” he states, “is not about spewing dogma regarding the virtues of functional programming. I think there are many functional techniques that offer ways to rein in the complexities of software development, but I realize that at times, there are better ways to implement any given individual part.”
Meanwhile, HaskellWiki offers this explanation of functional programming: “In functional programming, programs are executed by evaluating expressions, in contrast with imperative programming where programs are composed of statements which change global state when executed. Functional programming typically avoids using mutable state.
“Functional programming requires that functions are first-class, which means that they are treated like any other values and can be passed as arguments to other functions or be returned as a result of a function. Being first-class also means that it is possible to define and manipulate functions from within other functions.”
Some of the programming languages typically labeled “functional” include Clojure, OCaml, Erlang, Haskell, Scala, and F#.
Here is how Michael Fogus defines functional programming:
“As a bare-bones introduction, functional programming can be described in a single sentence:
Functional programming is the use of functions that transform values into units of
abstraction, subsequently used to build software systems.
(Underscore.js can be obtained from http://underscorejs.org and imported into “the applicable project directories.”)
Here is the chapter lineup for Fogus’s 237-page book:
- Chapter 2. First-Class Functions and Applicative Programming
- Chapter 3. Variable Scope and Closures
- Chapter 4. Higher-Order Functions
- Chapter 5. Function-Building Functions
- Chapter 6. Recursion
- Chapter 7. Purity, Immutability, and Policies for Change
- Chapter 8. Flow-Based Programming
- Chapter 9. Programming without Class
— Si Dunn