List of Figures

 

Lesson 2. Functions and functional programming

Figure 2.1. Defining a simple function

Lesson 3. Lambda functions and lexical scope

Figure 3.1. The simple function rewritten as a lambda function

Figure 3.2. How sumSquareOrSquareSum works using a lambda function

Figure 3.3. The sumSquareOrSquareSum function rewritten to use a let expression

Figure 3.4. Lexical scope with add1, add2, and add3

Lesson 5. Closures and partial application

Figure 5.1. The genIfEven function lets you build ifEvenX functions simply.

Figure 5.2. ifEvenInc with closure

Figure 5.3. Parts of a URL

Figure 5.4. Capturing the host value in a closure

Figure 5.5. Visualizing partial application

Figure 5.6. The flipBinaryArgs function

Lesson 6. Lists

Figure 6.1. A list is made up of the head element and the tail list.

Lesson 7. Rules for recursion and pattern matching

Figure 7.1. Visualizing pattern-matching internals for myHead

Lesson 8. Writing recursive functions

Figure 8.1. Visualizing collatz path lengths

Lesson 9. Higher-order functions

Figure 9.1. Visualizing foldl (+)

Figure 9.2. Visualizing foldl rcons

Lesson 10. Capstone: Functional object-oriented programming with robots!

Figure 10.1. Method-calling approach to OOP

Figure 10.2. Message-passing approach to OOP (commonly used in functional programming languages)

Lesson 11. Type basics

Figure 11.1. Type signature for a variable

Figure 11.2. Defining the double function by using a type signature