Jump to ratings and reviews
Rate this book

Clojure Programming: Practical Lisp for the Java World

Rate this book
The Clojure language is a practical alternative for everyday programming that offers expressivity rivaling other dynamic languages like Ruby and Python, but allows you to seamlessly take advantage of Java libraries, services, and all of the resources of the JVM ecosystem. This book helps you learn the fundamentals of Clojure with examples relating it to the languages you know already, in the domains and topics you work with every day. See how this JVM language can help eliminate unnecessary complexity from your programming practice and open up new options for solving the most challenging problems.
Clojure Programming demonstrates the language's flexibility by showing how it can be used for common tasks like web programming and working with databases, up through more demanding applications that require safe, effective concurrency and parallelism, data and statistical analysis, and more. This in-depth look helps tie together the full Clojure development experience, from how to organize your project and an introduction to Clojure build tooling, to a tutorial on how to make the most of Clojure’s REPL during development, and how to deploy your finished application in a cloud environment.

Learn how to use Clojure without losing your investment in the Java platform
Understand the advantages of Clojure as an efficient Lisp for the JVM
See how Clojure is used today in several practical domains
Discover how Clojure eliminates the need for many verbose and complicated design patterns
Deploy large web applications across tens or hundreds of cloud nodes with Clojure

630 pages, Paperback

First published August 15, 2011

81 people are currently reading
576 people want to read

About the author

Chas Emerick

2 books21 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
176 (37%)
4 stars
202 (43%)
3 stars
70 (15%)
2 stars
16 (3%)
1 star
1 (<1%)
Displaying 1 - 30 of 30 reviews
Profile Image for Rob.
Author 2 books436 followers
May 14, 2013
In Clojure Programming (Chas Emerick, Brian Carper, and Christophe Grand; O'Reilly, 2012), the preface asks Who is this book for? It's for a lot of people: experienced JVM developers, curious Rubyists, dissatisfied Pythonistas... Developers of all stripes that are looking to get introduced to, and become proficient in, Clojure. I myself have been circling the Clojure drainpipe for a while now, very nearly getting completely sucked in on numerous occasions. I've followed no one's advice though--I have not started small, and instead keep jumping into sophisticated middle parts and getting mired. [1] I think I would have benefitted from this book a year ago; I'm certainly benefitting from it now.

At 587 pages [2], Clojure Programming is hardly a tome, but it is comprehensive, appreciably thorough, and makes a concerted effort to be accessible to the Clojure and JVM neophyte. That being said, the book is also far from short, and makes no pretenses about easing you into the language: you'll be programming a naïve REPL by the end of chapter one. But this head-first approach is one of the reasons to love this book.

Emerick et al. found an excellent format for organizing the book, logically sequencing the material, and peppering chapters and sections with the right kind of illustrative, koan-style sample problems, eschewing the alternative of walking you through some contrived and over-arching application built one concept (and thus one chapter) at a time. As such, the book is broken into five sections:

1. Functional Programming and Concurrency (the foundation);
2. Building Abstractions (the sophisticated stuff);
3. Tools, Platform, and Projects (the eco-system);
4. Practicums (Clojure in the real world); and
5. Miscellanea (other important stuff).

What's marvelous about this structure is that you can decide for yourself whether to read it cover-to-cover, or whether to cherry-pick just the chapters relevant to your immediate challenges. What's helpful is that the book cross-references itself for many key concepts. In the thick of chapter one and you don't know what this "classpath" nonsense is? Jump ahead to chapter eight! [3] Deep into chapter nine and you're lost about how Clojure protocols relate to Java's interfaces? A footnote steers you back to chapter six! The care taken to create these kinds of cross-references is tremendously valuable because it allows you to opt-in to some advanced concepts early on, getting a preview of the powerful features ahead of you.

Though Clojure Programming is overflowing with thoughtful, detailed, and well-composed information, where it really shines is the "Practicums" section. When I first started skimming the chapters in this section, the first thought that occurred to me was: "Herein lies the true esoterica." I read about Clojure's numerics and mathematics, about its intriguing use of "rationals", about unchecked operations. I read about how to idiomatically implement different design patterns in Clojure. The deeper I got into this section though, the more that I realized that this was not a bunch of "out there" riddles and puzzles whose only purpose was to show off the sparkling fringes--no, this section was to demonstrate Clojure's solutions to "real world" problems, and the kind of advantages afforded you by its functional style. [4] That being said, I appreciated how Emerick et al. were vigilant in observing when different approaches or language features would serve you well, and when you would be wise to avoid them.

A few other items that I feel compelled to point out:

• The chapter on Java and JVM interoperability is strong. Anyone looking to introduce Clojure into their (JVM-based) organization would be wise to memorize this information...
• ...and then also memorize the chapter that specifically addresses how to go about introducing Clojure to your organization.
• As with the other Clojure texts I've read, their is a focus on discussing "idiomaticity", and differentiating between "working" or "valid" Clojure code, and idiomatic Clojure code. Seeing this again makes me wish that more authors writing about other languages put this much emphasis on idiomatic style.
• Also, I am filled with tremendous gratitude that Emerick et al., when they cite Wikipedia at all, cite particular articles as "a jumping off point" or as "a surprisingly good resource" for the subject matter. I have read several books recently that cite Wikipedia as an authoritative reference and... Well, I find that to be in bad form.

I find it easy to recommend Clojure Programming to anyone with an interest in the language. There is enough "introductory" material that smart programmers will be guided in the right directions as they get started, but there is also enough detailed coverage that the book will grow right along with you. The chapters on the Clojure eco-system will help to steer you toward the right tools and resources to organize, manage, and scale your projects--as well as how to integrate them laterally within the JVM. Lastly, the practicums give you concrete and balanced approaches to answering some of the questions that you go into the whole endeavor already asking. I will be referring to this book often as I continue my explorations into Clojure.

------

[1] Case study: the first significant chunk of time I spent with the language was with early drafts of The Joy of Clojure . JoC is definitely an "intermediate-to-advanced" book.

[2] Not counting the preface and index, which brings that up to 630.

[3] Which, I'd like to add, is currently my favorite semi-layman's explanation of the JVM's classpath.

[4] I suppose this should have been obvious from the name of the section. (What can I say? I got caught up in the details of rational numbers.)

------

Additional side notes:

1. I received a free electronic version of this text from O'Reilly in exchange for a review and a blog post.

2. At the time that I wrote this review, I had fully read chapters 1-5 and skimmed the remainder--paying particular attention to the JVM interoperability, "Introducing Clojure into Your Workplace", and the "Practicum" chapters (which I guess really is most of the rest of the book).
Profile Image for Jon Gauthier.
129 reviews239 followers
May 19, 2013
I often run into what you might call closet functional programmers – people who seem to have a genuine interest in acquainting themselves with a new paradigm, but just can’t manage to find the time to do it. Some of those who do invest the time often end up on something like the Typeclassopedia [1], where the combined force of jargon and type signatures kill whatever interest they began with.

Thanks to Clojure Programming, though, I’m happy to report that this will no longer be a problem. This book gives hope to those who have championed Lisp and / or functional programming in vain. Emerick et al. provide not only a thorough tour of the language, but also demonstrate the beauty and conciseness of its solutions to common problems. The book dedicates an entire section (“Practicum”) to describing how Clojure is idiomatically used in different application domains.

I was particularly pleased by the stellar coverage of some of Clojure’s most compelling features:

Concurrency primitives (ref, atom, agent, future, and friends)
The power of the JVM and easy Java interop
Lisp syntax (which makes for easy and powerful metaprogramming)
The sequence abstraction

These features are all explained in a bottom-up style (fitting for a Lisp!) – the authors build up a sizeable example by providing an implementation in small increments, explaining along the way. This style is a nice parallel to the nature of traditional Lisp programming.

This book would fit best any of these three groups:

Java refugees. Give me the JVM, hold the
AbstractSingletonProxyFactoryBean. Clojure Programming shows you how to take advantage of the vast Java ecosystem while avoiding some of the pitfalls of having static typing and OOP forced upon you. The authors make a good case for interactive programming with the Clojure REPL, which gives you a direct line to the JVM not usually available in Java-land.
Beginning functional programmers. For those already acquainted with a scripting language like Python, Ruby, etc., your first Clojure programs will be a breeze. The book spends a chapter first easing you into Clojure syntax before presenting the basics of functional programming in all of their greatness. You’ll come to love the paradigm and appreciate how Clojure facilitates its use so effectively.
Lispers. While Clojure is by no means a mainstream language, it provides a compelling case of a successful Lisp dialect. The later chapters, which provide examples of Clojure applications in all sorts of distinct domains, will definitely be of interest.

Beginners, intermediate users and masters alike will find something of use in Clojure Programming. It’ll be one of the first books I recommend from now on to anyone curious about Lisp or functional programming.

(Disclosure: I received an electronic copy of this book in exchange for writing a review.)

----

Footnotes:

1. I’ve absolutely nothing against this document – it’s a fascinating and wonderfully helpful piece of work – but when the first few paragraphs include the words “category theory,” “monoid,” etc., etc., beginners will tend to get spooked!
Profile Image for Oleksandr Golovatyi.
492 reviews42 followers
March 8, 2018
Чуть бы не единственная книга о языке программирования Clojure на русском языке. Почти вся литература про эту технологию только на английском, надеемся в будущем выбор книг будет намного больше. Книга большая и читается долго, она больше напоминает огромный справочник. Если вам нужно быстро начать с каких-то готовых решений, то книга вам не подойдет, но если вы хотите не спеша ознакомиться с основами этого прекрасного языка программирования и лишь попробовать его немного, то книга как раз подойдет.
Profile Image for Louis.
226 reviews30 followers
July 2, 2012
When I first started reading Clojure Programming, the first impression I had was that I've never seen a programming language introduction try so hard to tell me that my programming skills are going to grow significantly as a result of learning this programming language. This book is probably not for beginners, but working through this gives insights into why certain programming constructs work the way they do and how functional programming constructs fit with someone who is used to procedural and object oriented programming. While the efforts it makes to declare its superiority towards other languages gets annoying, the practice in using the REPL actually helps me understand how to better use tools I use in other languages.

My background is in scientific computing. And while I have used some standard languages such as Java, C, C++, and even Fortran, my first choice in languages tends to be either R or Python. The R environment is admittedly ugly, but in Python I typically use tools that surround the scientific ecosystem of ipython/Numpy/Scipy/Matplotlib. My programs tend to be structured into a data gathering and manipulation portion (MVC) then an analytics portions dominated by a series list comprehensions and map-apply and finally presentations of results. In this context, I first heard of Clojure because the Incanter: Data Sorcery project, which was an attempt to create a Lisp-based statistical computing and graphics platform. So I approached Clojure Programming with a view of its suitability for technical computing, or a way of learning functional programming techniques in a deeper fashion for use in R or Python data analytics.

It somewhat disappoints in this. When Clojure Programming put effort into demonstrating its unique points, such as the REPL, I kept on thinking "I already have this in Python/ipython" (in particular the ipython shell gives considerably more capability than the standard shell) When reaching the Numerics chapter, it seemed to be a discussion of standard data types (and when trying to discuss Python numerical types, not acknowledging Numpy data types and discussing performance is ignoring the real world.) My main complaint is that the discussions of language and environment features feels like I'm being presented with a long list of details, without having first having a general sense of what programming would be like. In many ways, it is similar to learning scientific programming in Python. You generally learn general programming first, and later on you learn the techniques for data analysis, many of which are based on functional programming practices.

What the book does well is explain deeply the principles behind the language and functional programming. In works through them with cross references in the text wherever they are necessary. And it explains why these principles are useful. In particular with the REPL, which if I had not had experience with the ipython shell would have been quite different then other shells.

What this leads me to conclude is that this book would be very good for someone with a solid grasp of Java programming, with its ecosystem and libraries, and wanted to move into functional programming. Clojure Programming provides a different workflow since it does compile/evaluate as you go, allowing you to see quickly the results of changes without any performance penalty. And having a different programming paradigm than object-oriented adds a set of tools that can be brought to bear under a different situation.

This was not quite what I was hoping for, but that may be because the tools and language features of Python/ipython were already overlapping with Clojure. It does fulfill the promise of making me a more knowledgable programmer. And I hope that working through Clojure Programming also makes me a better one.

Disclaimer: I received a free electronic copy of Clojure Programming as part of the O'Reilly Press Blogger program
Profile Image for Alex Ott.
Author 3 books207 followers
September 2, 2012
I think, that's now this is a best book about Clojure for novice. It covers language in great details, mixing description of high-level concepts with low-level details of implementation, use patterns, etc.
Profile Image for Aku.
35 reviews
July 14, 2012
Great introductory book on Clojure. The breadth of topics covered was large, and the authors wrote in a clear and communicative way. The early chapters cover wide swaths of ground in short time, striking a perfect balance between concise and thorough. I especially liked the discussion of different reference types Clojure offers. Elucidating examples and scenarios clarified the landscape perfectly.

I also liked the later practical parts, involving some staples of Clojure ecosystem such as Ring, Compojure and Korma. This is something that I really missed in Learn You A Haskell for Great Good for example. Even deployment to AWS was covered, something that is nearly universally absent even from other hands-on books.

On to the nitpicks.

The book suffers a little bit from the constant overuse of forward (and backward!) references, sometimes pointing to the very next page. The order of the chapters is also weird: macros are handled really early, well before records or types for instance. Perhaps this is right from the perspective that macros really are fundamental to Clojure and to the Lisp family in general, but it is unfamiliar ground for most programmers and I feel the topic requires more than a single isolated chapter to be fully covered.

The nonrelational database chapter covers CouchDB, which I feel is a weird choice for a book written in 2011, given the dominance of MongoDB in the field and the fair deal of turmoil in CouchDB vs Couchbase division. I can understand that one of the authors has extensive experience with CouchDB and so it was natural for him to write the chapter, but I would have appreciated at least cursory glance at other players such as MongoDB, Riak, Redis, Cassandra etc. instead of focusing solely on one of the options.

Early on the book suffers from a weird defensive writing style with uninvited comparisons to Java, Ruby and Python. Clojure is good enough on its own, it certainly does not require belittling other languages to make it shine. Comparisons against Java in particular are intelligently dishonest. If there needs to be a pissing match, it should be between other functional programming languages such as Haskell and Scala, who compete for attention with Clojure. The book remains strangely silent on that front.
Profile Image for Ash Moran.
79 reviews40 followers
March 16, 2013
Note: I literally only read this, I didn't work through any of the code. I was expecting to want to pick up a keyboard, but most of the book didn't inspire me to do so (I have some notes for bits to go back to though).

This is much more comprehensive than I was expecting, and covers much more ground in Clojure than say Programming Ruby in Ruby. A good chunk at the start was quite a mundane functional programming intro. I got a little tired after a while of some of the insubstantial arguments against OOP, especially an example of why mutable state is bad demonstrated by abusing an object's state to fake an identity change. (Turning Person "Sue" into Person "Bob", or something.)

The later bits were much more interesting. I enjoyed the descriptions of protocols, multi-methods and macros. I'd like to go back and experiment with these. They look like powerful language features, and the book seems to have quite detailed examples, covering edge cases. (The concurrency sections are also well written with detailed examples, but I'm still not sold on immutable state as the primary solution to solve concurrency problems.)

There's a lot of good stuff in here. I'm provisionally giving it 4 stars on the basis it's about as detailed and comprehensive a language book as I've read, and I've got lots of things I know I can try if I fire Clojure up, but it hasn't turned my brain inside out, like even the start of Structure and Interpretation of Computer Programs did.
Profile Image for Steven Grimm.
38 reviews5 followers
February 9, 2014
Even though it took me quite a while to get through, I enjoyed this more than I can remember enjoying any introductory computer language book in the past. It is quite comprehensive, covering not only the core language but also several popular third-party libraries. The explanations are generally clear and, with a few exceptions, the examples do a great job of reinforcing the information in the text. The emphasis is very much on building code to do real work, so the examples mostly stay away from the "compute the prime factors" kinds of algorithms that are ubiquitous in introductions to functional programming languages.

The main reason I'm rating it 4 stars instead of 5: in a number of places, core library functions are used in example code and never explained, or not explained until much later in the book. I found I had to have a web browser open to the Clojure documentation to follow some of the examples. This doesn't happen frequently, but still often enough to be distracting.

Since Clojure is a language on the Java virtual machine, having at least a passing familiarity with Java will be helpful. The book describes and uses Clojure's Java interoperability features, and they won't make much sense if you have no idea how Java code works. It also uses examples in Python and Ruby to illustrate the different approaches Clojure takes to certain things. Knowing those languages is not required (the examples are mostly fairly self-explanatory) but won't hurt either.

After reading the book you will likely be convinced that Clojure brings some interesting and valuable things to the table and, if you're like me, will be champing at the bit to use it in a real project. That's probably the best endorsement one can give a programming language book!
Profile Image for Glenn.
21 reviews1 follower
February 10, 2014
Great pacing. I like the order in which information was presented. The author wet your appetite with some introductory programming material. Then, he proceeded with covering the high level topics such as functional programming, homoiconicity, software transactional memory, and persistent data structures.

The author certainly advocates for idiomatic Clojure without getting evangelical about it. He is able to cover special forms, syntactic sugar, macros, object orientation, multi-threading, and lazy evaluation in a way where you don't feel like you need to jump around a lot in the book.

He finishes up with some practical advise on database access, connection pooling, web service development, build and release capability, and deploying to the cloud.

A really good introduction to all relevant aspects to this modern version of the Lisp programming language.
Profile Image for Andrew.
148 reviews7 followers
January 11, 2016
I found this a tremendously helpful book. I recommend it to strong programmers who wish to learn clojure. It is also a comprehensive book, and I'm happy to put it down for the time being having read only the first four chapters: I already have such a store of language features that I want to put to use and commit to practice without having to know the more arcane corners of the language.

My only quibble: I wish there were something like a cheat sheet of the syntactical forms and key functions tucked into an appendix, because I often got a little bogged down following some examples without access to the internet
Profile Image for Matthew Darling.
18 reviews1 follower
August 10, 2014
A great introductory Clojure book. I didn't know a lick of Lisp before I started, but I feel pretty literate now that I've finished. It's a big book, but every chapter is either useful or interesting (and often both).

I do wish the second edition were more substantial than just incorporating various errata, though.

Side note: If you need a Clojure editor and don't have a prior preference for a particular IDE base like IDEA or Eclispe, consider Light Table. If you're feeling adventurous, we use this Emacs config at work.
Profile Image for Hussein.
13 reviews
August 18, 2012
An excellent read about Clojure programming language, covers a lot of areas and some times in an enjoyable depth.
Data structure chapter was amazing, you are going to learn a lot. Data structures are at the very heart of Clojure professional programming.
Macros chapter isn't impressive, I was expecting a much more from the hall-of-famers authors.
Build tools section was somehow, I don't know, boring and shouldn't takes a lot of pages. But maybe it written this way for non-Java programmers how are reading the book.
Profile Image for Coen.
22 reviews3 followers
May 15, 2012
Nice book, but I'd have loved to see more depth in the last part of the book, with more examples of real world usage instead of mentioning a list of interesting projects. Also some basic syntax highlighting of the code example in the book wouldn't hurt anyone!
I still prefer 'The joy of Clojure' and 'Programming Clojure' over this Clojure book.
Profile Image for Jake McCrary.
424 reviews25 followers
November 2, 2012
Read this book with the background of someone who has been in some way writing Clojure code for approaching 4 years. Some code has been written in production but most as a hobby.

I thought this explained concepts extremely well. I would recommend this to Clojure programmers of all skill level. I found coworkers asking me Clojure questions and suggesting sections of this book as answers.
Profile Image for Dave Peticolas.
1,377 reviews45 followers
November 22, 2015
This is a very good reference to Clojure, I can recommend it for anyone wanting to learn the language. I like a lot of the ideas in Clojure and it's well worth learning the basics just to be introduced to them. Ultimately, I found I just didn't find the language as compelling as some others I've learned recently like Erlang and Go, which seem to require a smaller mental model to work in.
3 reviews1 follower
March 29, 2014
This is my favorite of the clojure books. I've been programming for about 20 years, but am new to Lisp. I found it clear, well written, and appropriate to my skill level as a professional programmer who's just finished working through Conrad Barski's Land of Lisp.
Profile Image for Ameer.
39 reviews11 followers
May 7, 2014
Very awesome intro and thorough guide through Clojure. Well thought out examples that show the benefits of the language and break out of whatever paradigm you were thinking in before. My second favorite programming language book after The C Programming Language.
2 reviews
May 29, 2012
Good overview of Clojure, with focus given to deployment, and web development.
Profile Image for Daniel MacDougall.
7 reviews1 follower
December 4, 2012
Thorough explanation not just of the language but also current libraries, frameworks, project structuring, and deployments.
Profile Image for taylor.
94 reviews5 followers
June 5, 2013
Can't decide if functional languages are the next big thing or just a mathematical meme
Profile Image for Josh Mock.
4 reviews5 followers
July 12, 2014
Technically not fully read cover to cover, just the important bits. Programming books are best as references while learning by doing.
Profile Image for Graham Lee.
119 reviews28 followers
May 20, 2015
Really useful information, but I didn't get the opportunity or the excitement to dive into Clojure. I still need to find a thing to do that'll give me that opportunity.
Profile Image for Jeffrey.
22 reviews
Read
March 3, 2016
Good start - lot's to learn about clojure.
I didn't finish it, not a practical language (even clj-clr) unfortunately.
Displaying 1 - 30 of 30 reviews

Can't find what you're looking for?

Get help and learn more about the design.