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 entire book as a PDF now, plus other formats including the printed book once they're available. If you're not quite ready to buy, you can read the first chapter for free. A large excerpt of chapter 5 is available on InfoQ. Check it out before you decide to buy.
TABLE OF CONTENTS
- Foreword (to be announced)
- Acknowledgments
- Introduction
- Notational Conventions
- Getting Clojure
- Road Map
- Clojure Philosophy
- The Clojure Way
- Why a(nother) Lisp?
- Functional Programming
- Why Clojure is Not Especially Object-oriented
- Summary
- Drinking From the Clojure Firehose
- Scalars
- Putting Things Together: Collections
- Making Things Happen: Functions
- Vars
- Locals, Loops, and Blocks
- Preventing Things from Happening: Quoting
- Leveraging Java via Interop
- Exceptional Circumstances
- Namespaces
- Summary
- Dipping Our Toes Into the Pool
- Truthiness
- nil Pun With Care
- Using Destructuring
- Using 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
- Persistent Sets
- Thinking in Maps
- Putting It All Together: Finding the Position of Items in a Sequence
- Summary
- Being Lazy and Set in Your Ways
- On Immutability
- Designing a Persistent Toy
- On Laziness
- Putting It All Together: A Lazy Quicksort
- Summary
- Functional Programming
- Functions in All Their Forms
- Closures
- Thinking Recursively
- Putting It All Together: A* Pathfinding
- Summary
- Macros
- Data is Code is Data
- Defining Control Structures
- Macros Combining Forms
- Using Macros When Changing Forms
- Using Macros to Control Symbolic Resolution Time
- Using Macros to Manage Resources
- Putting It All Together: Macros Returning Functions
- Summary
- Combining Data and Code
- Namespaces
- Exploring Multimethods with the Universal Design Pattern
- Types, Protocols, and Records
- Putting it All Together: A Fluent Builder for Chess Moves
- Java.next
- Generating Objects On the Fly with proxy
- Clojure gen-class and GUI Programming
- Clojure's Relationship to Java Arrays
- All Clojure Functions Implement...
- Using Clojure Data Structures In Java APIs
- definterface
- Be Wary of Exceptions
- Summary
- Mutation
- Software Transactional Memory with Multiversion Concurrency Control and Snapshot Isolation
- When To Use Refs
- When To Use Agents
- When To Use Atoms
- When To Use Locks
- When To Use Futures
- When To Use Promise and Deliver
- Parallelism
- Vars and Dynamic Binding
- Summary
- Performance
- Type Hints
- Transients
- Chunked Sequences
- Memoization
- Understanding Coersion
- Summary
- Clojure Changes the Way You Think
- DSLs
- Testing
- A Lack of Design Patterns
- Error Handling and Debugging
- Fare Thee Well
- Appendix A: Clojure Style
- Appendix B: Annotated Bibliography
