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
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
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
Listing 10.1. Example code that fetches and filters expenses from a data store
Listing 10.2. Simple stubbing and mocking macro functionality for Clojure tests
Chapter 11. More macros and DSLs
Listing 11.1. A general rotation cipher system to implement things like ROT13
Listing 11.2. Basic functions to handle session persistence in Redis
Listing 11.3. dsl-store namespace for storing the rules as anonymous functions
Listing 11.4. Segmentation DSL defined using a simple macro
Listing 11.5. Simple DSL execution engine to classify users into segments