Clojure Brain Teasers (Pragmatic Bookshelf)

PragmaticBookshelf
Hone your Clojure skills and validate your understanding as you explore the design decisions behind this data-driven functional programming language.

Alex Miller @alexmiller and Lorilyn Jordan Miller

edited by Jacquelyn Carter @jkcarter

Challenge your knowledge of Clojure with 25 short Clojure teasers, sometimes with surprising results! Inspired by years of developer questions and feedback, these teasers are handpicked to clarify common points of confusion. Each code challenge illustrates Clojure’s elegant design, explaining how and why it works. Enjoy these simple exercises solo or with friends to find gaps in your knowledge, challenge assumptions, and gain valuable insights. Tackle the most common points of confusion Clojure developers encounter, become more efficient when writing and debugging, and better predict the outcomes of Clojure code. Regardless of your Clojure experience, you’re certain to learn something new.

You know Clojure, but do you really understand it? You may know the mechanics and idioms, but what about the deeper, implicit concepts driving the design? Discover and explore the real Clojure, testing and supplementing your understanding of why this data-driven functional programming language works the way it does.

You’ll start with the basic concepts such as numeric types, numeric promotion, and logical truth. But the backbone of Clojure is its focus on immutable data, centered around the Clojure collections. Learn about collection equality, polymorphism on nil, adding and finding elements in different collection types, and sorted collections. Explore Clojure’s evaluation model, including the Clojure reader, quoting, evaluation, and macro expansion. Finally, learn about the core library functions like case, concat, for, partial, and the details of type hinting, vars, and destructuring. Understand the peculiarities of these functions and how to apply them to your advantage in future programs.

Use these new insights to build your own concise, expressive, and flexible code. Don’t just use Clojure, master it.


Alex Miller has been a member of the Clojure core team since 2013 and is the co-author of Clojure Applied and Programming Clojure, Third Edition. Alex is the creator or organizer of the Strange Loop, Lambda Jam, Clojure/west, and Clojure/conj conferences.

L. Jordan Miller is a Staff Software Engineer at Nubank, Datomic Developer Advocate, and producer/host of the Lost In Lambduhhs podcast. Passionate about people, programming, and pedagogy, she’s a conference speaker, host, organizer, and reviewer for events such as Heart of Clojure, Strange Loop, Re:clojure, and Clojure Conj.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

Latest Threads About This Book Top

alexmiller
The teaser and demo of “A Case of Mistaken Identity”, puzzle #18, pg 76 of p1.0 have a typo on the final line of code - identity should b...
New
tlonist
Title: Clojure Brain Teaser (page 8) There’s a typo in Acknowledgements, where it says 'Clojure to create life changing oppertunities’.
New
pwhittin
In the paragraph: “There are fundamentally three kinds of Clojure collections for the purposes of equality—sequential, set, and map. Any...
New
hsolg
The breakdown in the discussion seems to be for a different version of the code. The summary of counts at the end is correct, but after “...
New
hsolg
@alexmiller Page 26: “compare equal to another collection with the same partition” → “compare equal to another collection within the sam...
New
New
hsolg
@alexmiller I love (and need) this book, so thank you for great work! I have a comment on Puzzle 2. The discussion says “BigInt values a...
New
PragmaticBookshelf
Hone your Clojure skills and validate your understanding as you explore the design decisions behind this data-driven functional programmi...
New

Most Active This Week Top

Most Active This Month Top

Most Active This Year Top

PragmaticBookshelf
Hone your Clojure skills and validate your understanding as you explore the design decisions behind this data-driven functional programmi...
New
hsolg
@alexmiller I love (and need) this book, so thank you for great work! I have a comment on Puzzle 2. The discussion says “BigInt values a...
New
hsolg
@alexmiller Page 26: “compare equal to another collection with the same partition” → “compare equal to another collection within the sam...
New
hsolg
The breakdown in the discussion seems to be for a different version of the code. The summary of counts at the end is correct, but after “...
New
New

Most Active Last Three Years Top

Most Active Over Three Years Top