Chapter 1. Introduction

Our first step before we get into actual examples is to look at what defines functional programming. Specifically, we will look at the components that make up functional programming and how they relate to mathematics.

Note

Functional programming traces its roots all the way back to LISP, although the paradigm name itself wasn’t truly coined until John Backus delivered his 1977 Turing Award–winning paper “Can Programming Be Liberated From the von Neumann Style? A Functional Style and Its Algebra of Programs.” In his lecture, Backus discusses multiple points about applications being built as combinations of algebraic equations.

Overview of Concepts in Functional Programming

Although there is still some disagreement about what functional programming is, there are a few features that are generally agreed to be part of it:

  • First-class functions
  • Pure functions
  • Recursion
  • Immutable variables
  • Nonstrict evaluation
  • Statements
  • Pattern matching

First-Class Functions

First-class functions can either accept another function as an argument or return a function. Being able to create functions and return them or pass them to other functions becomes extremely useful in code reusability and code abstractions.

Pure Functions

Pure functions are functions that have no side effects. Side effects are actions a function may perform that are not solely contained within the function itself. When we think about side effects, we normally think about other functions, such as println or ...

Get Becoming Functional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.