Clojure in Action
Amit Rathore
  • November 2011
  • ISBN 9781935182597
  • 432 pages
  • printed in black & white

An easy to read book and a great way to get up-to-speed on Clojure.

Craig Smith, Suncorp


Clojure in Action, Second Edition is now available. An eBook of this older edition is included at no additional cost when you buy the revised edition!

A limited number of pBook copies of this edition are still available. Please contact Manning Support to inquire about purchasing previous edition copies.

Clojure in Action is a hands-on tutorial for the working programmer who has written code in a language like Java or Ruby, but has no prior experience with Lisp. It teaches Clojure from the basics to advanced topics using practical, real-world application examples. Blow through the theory and dive into practical matters like unit-testing and environment set-up, all the way through building a scalable web-application using domain-specific languages, Hadoop, HBase, and RabbitMQ.

Table of Contents detailed table of contents


acknowledgments about this book



Part 1 Getting started

1. Chapter 1 Introduction to Clojure

1.1. What is Clojure?

1.2. Understanding Clojure syntax

1.3. The sources of Clojure’s power

1.4. Clojure—beyond object orientation

1.5. Summary

2. Chapter 2 A whirlwind tour

2.1. Getting started

2.2. Program structure

2.3. Program flow

2.4. Clojure data structures

2.5. Summary

3. Chapter 3 Building blocks of Clojure

3.1. Functions

3.2. Scope

3.3. Namespaces

3.4. Destructuring

3.5. Metadata

3.6. Summary

4. Chapter 4 Polymorphism with multimethods

4.1. Polymorphism

4.2. Method dispatch

4.3. Multimethods

4.4. Summary

5. Chapter 5 Clojure and Java interop

5.1. Calling Java from Clojure

5.2. Compiling Clojure code to Java byte code

5.3. Calling Clojure from Java

5.4. Summary

6. Chapter 6 State and the concurrent world

6.1. The problem with state

6.2. Identities and values

6.3. The Clojure way

6.4. Refs

6.5. Agents

6.6. Atoms

6.7. Vars

6.8. State and its unified access model

6.9. Watching for mutation

6.10. Futures and promises

6.11. Summary

7. Chapter 7 Evolving Clojure through macros

7.1. Macro basics

7.2. Macros from within Clojure

7.3. Writing your own macros

7.4. Summary

Part 2 Getting real

8. Chapter 8 Test-driven development and more

8.1. Getting started with TDD

8.2. Mocking and stubbing things

8.3. Organizing tests

8.4. Summary

9. Chapter 9 Data storage with Clojure

9.1. MySQL & clj-record

9.2. HBase

9.3. Redis

9.4. Summary

10. Chapter 10 Clojure and the web

10.1. An HTTP interface from scratch

10.2. Ring

10.3. Compojure

10.4. Generating HTML

10.5. Summary

11. Chapter 11 Scaling through messaging

11.1. Messaging systems

11.2. Clojure and RabbitMQ

11.3. Distributed parallel programming

11.4. Summary

12. Chapter 12 Data processing with Clojure

12.1. The map/reduce paradigm

12.2. Master/slave parallelization

12.3. Summary

13. Chapter 13 More on functional programming

13.1. Using higher-order functions

13.2. Partial application and currying

13.3. Closures

13.4. Summary

14. Chapter 14 Protocols, records, and types

14.1. The expression problem

14.2. Modus operandi

14.3. Protocols and data types

14.4. Summary

15. Chapter 15 More macros and DSLs

15.1. Macros

15.2. Domain-specific languages

15.3. Summary

© 2014 Manning Publications Co.

About the Technology

Clojure is a modern Lisp for the JVM, and it has the strengths you'd expect: first-class functions, macros, support for functional programming, and a Lisp-like, clean programming style.

About the book

Clojure in Action is a practical guide focused on applying Clojure to practical programming challenges. You'll start with a language tutorial written for readers who already know OOP. Then, you'll dive into the use cases where Clojure really shines: state management, safe concurrency and multicore programming, first-class code generation, and Java interop. In each chapter, you'll first explore the unique characteristics of a problem area and then discover how to tackle them using Clojure. Along the way, you'll explore practical matters like architecture, unit testing, and set-up as you build a scalable web application that includes custom DSLs, Hadoop, HBase, and RabbitMQ.

What's inside

  • A fast-paced Clojure tutorial
  • Creating web services with Clojure
  • Scaling through messaging
  • Creating DSLs with Clojure's macro system
  • Test-driven development with Clojure
  • li>Distributed programming with Clojure, and more

About the reader

This book assumes you're familiar with an OO language like Java, C#, or C++ but requires no background in Lisp or Clojure itself.

About the author

Amit Rathore is a VP of Engineering with a decade of experience building highly performant, data-heavy web applications.

combo $49.99 pBook + eBook

FREE domestic shipping on three or more pBooks

Down-to-earth and thorough.

Stuart Caborn, BNP Paribas

Explains functional programming with Java.

Doug Warren, Java Web Services

An intriguing mix of emerging tech.

Andrew Oswald, Chariot Solutions

Teaches you how to put Clojure into action at warp speed!

Baishampayan Ghose, Qotd, Inc.