Clojure Recipes

Author: Julian Gamble
Publisher: Addison-Wesley
Pages: 288
ISBN: 978-0321927736
Print: 0321927737
Audience: Clojure programmers
Rating: 4 
Reviewer: Alex Artmstrong

A cookbook for a difficult language like Clojure - can that work?

You might want to argue with my characterization of Clojure as being a difficult language. However, it is based on Lisp and most people regard it as not a beginner's language. The problem is that if you can program in Clojure you probably don't want the usual cookbooks that go through simple things like how to reverse a string or remove spaces. Fortunately, this isn't really a traditional cookbook and to call what it presents you with "recipes" is a bit misleading. They are more like small case studies or tutorials on getting something specific done.


To give you an idea of what sort of thing is covered there is little choice but to list the chapters. Each one takes a standard format with variations as necessary:

  1. Assumptions
  2. Benefits
  3. The Recipe—Code
  4. Testing the Recipe
  5. Notes on the Recipe
  6. Conclusion

The first  two chapters are about getting started with Clojure and using the basic tools:

1. Starting Your Project with Leiningen 

2. Packaging Clojure for a Java EE Environment


The following six chapters are about creating servers of one kind or another:

3. Creating a REST Server in Compojure

4. Creating a REST Server with Liberator

5. A REST Client in ClojureScript

6. A Simple JSON Server

7. A Simple Server Using the Pedestal Framework

8. A Stock Ticker on the Pedestal Framework Server


Two chapters introduce macros and the way that they can be used:

9. Simplifying Logging with a Macro

10. Extending the Compiler with a Macro


From this point in the book the topics become increasingly applied and general. They serve to show how Clojure can be used to do a job:

11. Simplifying Datomic Syntax by Writing a DSL

12. Reading the SASS DSL and Generating CSS with Clojure Zippers

13. Introduction to Cascalog

14. Cascalog and Hadoop

15. Loading a Data File into Cascalog

16. Writing Out a Data File with Cascalog

17. Cascalog and Structured Data

18. Loading Custom Data Formats into Cascalog

19. Connecting to Datomic from Your Application

20. Getting Started with Storm

21. Getting Started with JMS in Clojure

22. Integrating Storm and JMS


The final few chapters are mostly about deploying and developing with Clojure:

23. A CSV Reader

24. Detecting Errors with a Log Monitoring Application

25. Bundling Clojure as an Ant Plug-in

26. Bundling Clojure as a Maven Plug-in

27. Integrating Clojure by Scripting Web Tests

28. Monitoring Availability with a Website Status Checker



You can tell from the chapter list that this book is mostly about the infrastructure that surrounds Clojure and, as already stated, it isn't a traditional language based recipe book. It doesn't tell you much about Clojure itself but it does tell you about using Clojure with other Clojure- based tools. It goes without saying that you need to be able to program in Clojure and reasonably well before reading it. This book would suit the Clojure programmer who wants to move on from programming toy examples to something real. Of course, how useful it is going to be depends on whether or not any of the recipes apply to you. If even just one does then it is almost certainly worth buying a copy of this book. 


Related Reviews

Seven More Languages in Seven Weeks

Web Development with Clojure



To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.


PostgresSQL 14 Administration Cookbook

Author: Simon Riggs and Gianno Ciolli
Publisher: Packt Publishing
Pages: 608
ISBN: 978-1803248974
Kindle: B09R4VBHX3
Audience: PostgresSQL developers and administrators
Rating: 4.5
Reviewer: Kay Ewbank

While this book describes itself as a cookbook, the recipes in it work through the nec [ ... ]

Professional C++, 5th Ed (Wrox)

Author: Marc Gregoire
Publisher: Wrox
Date: February 2021
Pages: 1312
ISBN: 978-1119695400
Print: 1119695406
Audience: C++ developers
Rating: 4
Reviewer: Mike James

Professional C++? Who wants to be unprofessional?

More Reviews


Last Updated ( Tuesday, 27 June 2017 )