List of Listings

 

Chapter 3. Building blocks of Clojure

Listing 3.1. Mutually recursive functions that can blow the stack

Listing 3.2. Mutually recursive functions that can be called with trampoline

Listing 3.3. Function composition using higher-order functions

Listing 3.4. Dynamic scope in action

Listing 3.5. A higher-order function for aspect-oriented logging

Listing 3.6. Using external libraries by calling use

Listing 3.7. Using external libraries by calling require

Listing 3.8. Using external libraries by calling require

Chapter 5. Exploring Clojure and Java interop

Listing 5.1. An abstract Java class that will be used to illustrate gen-class

Listing 5.2. gen-class generates a Java class to reference AbstractJavaClass

Listing 5.3. Leiningen project file for ConcreteClojureClass

Chapter 8. More on functional programming

Listing 8.1. A simple object system for Clojure

Chapter 9. Protocols, records, and types

Listing 9.1. Skeleton Java class implementing the concept of the expense item

Listing 9.2. Implementing modus operandi on top of multimethods

Listing 9.3. The expense namespace using the modus operandi multimethod syntax

Listing 9.4. Testing the implementation of modus operandi calculating expense totals

Listing 9.5. expense namespace using a Clojure protocol

Listing 9.6. expense namespace using a Clojure protocol and defrecord

Listing 9.7. expense namespace with defrecord and inline protocol

Chapter 10. Test-driven development and more