The Joy of Clojure
Thinking the Clojure Way
A book by Michael Fogus and Chris Houser
We’re really enjoying Clojure, and we’d like to share our knowledge and experience with you. The Joy of Clojure can now be pre-ordered, which gives you access to the first four chapters now, plus more as we write them. If you're not quite ready to buy, you can read the first chapter for free. A large excerpt of chapter 4 is available on InfoQ. Check it out before you decide to buy. For updates on the book itself and Clojure in general, check back here or subscribe at any of our news links listed below.
The table of contents is very much subject to change, but here are our current plans for the book:
TABLE OF CONTENTS
- Clojure
- A Book for the Adventurous
- Useful Examples
- A Word About Notation
- Getting Clojure
- Building Clojure
- Running Clojure
- Clojure Philosophy
- The Clojure Way
- Why a(nother) Lisp?
- Functional Programming
- Why Clojure is Not Especially Object-oriented
- Clojure's Bare Necessities
- Summary
- Dipping Our Toes Into the Pool
- Observe Basic Clojure Style
- Using Clojure As a Scripting Language
- Truthiness
- nil Pun With Care
- Using Destructuring
- Use the REPL to Experiment
- Summary
- On Scalars
- Understanding Precision
- Try To Be Rational
- When To Use Keywords
- Symbolic Resolution
- Regular Expressions - The "Second Problem"
- Summary
- Composite Data Types
- Persistence, Sequences, and Complexity
- Vectors: Creating and Using Them in All Their Varieties
- Lists: Clojure's Code Form Data Structure
- How to Use Persistent Queues
- Sets: Persistent and Mathematical
- Map Varieties and How to Use Them
- Case Study: Finding the Position of Items in a Sequence
- Summary
- Being Lazy and Set in Your Ways
- On Immutability
- Designing a Persistent Toy
- On Laziness
- Summary
- Functional Programming
- Functions
- Closures
- Recursion
- Summary
- Macros
- Evaluation of Data as Code
- Defining Control Structures
- Macros Combining Forms
- Using Macros When Changing Forms
- Using Macros to Control Symbolic Resolution Time
- Using Macros to Manage Resources
- Macros Returning Functions
- The Clojure Arrows
- Summary
- Combining Data and Code
- Namespaces
- Exploring Multimethods with the Universal Design Pattern
- Types, Protocols, and Reify
- Java.next
- Generating Java On the Fly
- GUI Programming With Clojure gen-class
- Understand Clojure's Relationship to Java Arrays
- All Clojure Functions Implement...
- Be Wary of Exceptions
- Extending Clojure
- Using Clojure In Your Java Programs
- Summary
- Concurrency / Mutation Idioms
- What STM and Agents Make Easy
- When To Use Refs
- When To Use Agents
- When To Use Atoms
- When To Use Primitive Locking
- When To Use Futures
- When To Use Promise and Deliver
- When To Use pmap
- Cells
- Understanding per-thread Bindings
- Summary
- Performance
- Type Hints
- Transients
- Chunked Sequences
- Memoization
- Primitives and Coersion
- Avoiding Boxed Args with Macros or definline
- Hotspot Inlining and Escape Analysis
- Summary
- Clojure Will Change the Way You Program
- DSLs
- Testing
- Refactoring
- A Lack of Design Patterns
- Summary
- Appendix A: Clojure's Bare Necessities
- Appendix B: Tool Support
