Clojure guides

The 100 Most Used Clojure Expressions

Would you like to optimize your learning of Clojure? Would you like to focus on learning only the most useful parts of the language first? Take this lesson from second language learning: learn the expressions in order of frequency of use.

13 hours of Lisp

My personal notes from the Lisp50 event at OOPSLA 2008.

3 Things Java Programmers Can Steal from Clojure

Many of the cool parts of Clojure are written in Java. That means you can access those parts from any Java code. Just include the Clojure JAR, import the classes, and you've got better tools.

A reduce Example Explained

A deep-dive into a single reduce example shows how much can happen in a short bit of code.

Some Annotated clojure.core/reduce Examples

reduce is a very useful function. You can use it for many calculations over a collection. Code annotations are useful, as are physical metaphors.

Are there any DOM manipulation libraries in ClojureScript?

ClojureScript has some nice DOM manipulation options, including jQuery and more idiomatic libraries.

What my daughter's blocks teach us about learning

My daughter's blocks taught her to match shapes with a lot of fast feedback. Fast feedback is a powerful tool to learn any skill. I analyze how the blocks helped my daughter learn and compare it to learning Clojure.

Clojure is a better Java than Java

How is it possible that Clojure is better than Java at its own game? Hear me out, then decide for yourself.

Recommendations for Next-Level Clojure

There are many classics of functional programming that can help you take your thinking to the next level. My recommendations are for making you think in a new way.

Clojure Web Security

Use the OWASP Top Ten Project to minimize security vulnerabilities in your Clojure web application.

Clojure's Hosted Legacy

Clojure was designed as a hosted language. So what is Clojure, the language, if it relies on the features of a host? And what are the disadvantages of choosing the JVM as a host?

Clojure's unsung heroics with concurrency

People know about the immutable data structures and the STM. But there's something going on at a much deeper level that is really hard to get right in Java. It has to do with the optimizations the JIT will run on your code.

Will having ClojureScript, yet another asset type, slow down my deploys?

ClojureScript builds can take a long time. But the extra time is worth it. It reduces the download size significantly.

Why does Clojure's conj add to the end of vectors but the beginning of lists?

conj can be confusing if you're used to other languages. It is not a commonly defined operation. Most languages define common positional adding operations. conj, however, has more useful semantics. How do you use conj usefully if you can't guarantee the position?

Conveyor Belts: Nature's core.async Channels

Conveyor belts are strikingly similar to Clojure core.async channels. While it could be a coincidence, there is speculation that conveyor belts were influenced by a deep understanding of core.async.

Exponential Backoff

A common failure in distributed systems is a server with a rate limit or with no limit but begins failing due to load. A standard solution is to retry after waiting a small time, increasing that time after each failure. We create a macro to handle this waiting and retrying.

4 Features Javascript can steal from Clojure(Script)

ClojureScript adds a lot of value on top of the Javascript platform. But some of that value can be had directly in Javascript without using a new language.

Functional JavaScript

Many of us have to use JavaScript. But does that mean we can't use functional programming? Sure, with discipline. But can we make it even easier?

How do Clojure Programmers Deal with Long Startup Times

Clojure startup times suck. Let's just be honest. How do Clojure programmers live with that? Maybe that's the wrong way to think about it.

Why I start teaching Clojure with Imperative Programming

LispCast Introduction to Clojure starts with 30 minutes of imperative programming. We write programs for their effects, so imperative is a great place to start.

Is core.async Against the Clojure Philosophy?

Clojure core.async is a way to manage mutable state. Isn't that against functional programming?

Java Generational Garbage Collection

The JVM's garbage collector allows for Clojure's persistent data structures to be practical. It's one of the benefits of being a hosted language: you can take advantage of the millions of dollars invested into the JVM's development.

JVM Deployment Options

When you're working at a company, you usually inherit their deployment system. And that's great because then you just do what they do. But what if you are on your own? What are the options for deploying a Clojure server?

JVM JIT Optimizations

The JVM JIT is a highly optimized compiler. I present some resources for learning what it does.

Lambda Abstraction

Lambda abstractions are always leaky, but some are leakier than others. Clojure programmers recommend keeping most of your functions pure and containing the leaks as much as possible.

Locks vs Concurrency Primitives

Many people have asked me why Clojure has concurrency primitives. Aren't locks good enough? A humorous metaphor is elaborated.

How can more layers be more efficient?

It's common that adding more layers of abstraction or indirection will make things slower. However, React and ClojureScript make web pages faster than doing it by hand — essentially programming the bare web. The lesson is that if you choose your layers well, they can actually make your system faster.

Moving Average in Lodash

We write a clean, readable, functional implementation of Moving Average with Lodash.

Object-Oriented Dispatch is the Dual of Functional Dispatch

Object-oriented dispatch is contrasted with functional dispatch, but they are shown to be two one-dimensional projections of the same two-dimensional data. Clojure does not provide the two-dimensional representation, but does interesting things to transcend the one-dimensional views.

The Parts of Ring

Ring, the Clojure Web library, defines three main concepts that you use to construct web applications.

Problems with the JVM

The JVM is great but far from perfect. Here are some problems with the JVM that Clojure has to work around.

React: Another Level of Indirection

React provides a better abstraction over the DOM than MVC frameworks ever can. React is the last piece of the puzzle for ClojureScript web frontend development.

6 things Reacters do that Re-framers avoid

Down on React? You should check it out from the ClojureScript perspective.

Reduce Complexity with Variants

The structure of our data should match the relevant structures in the real world. And to ensure that our data is structured well, we should reduce the potential for incorrect structure. Variants provide a great solution for it.


Reification means making an abstraction into a concrete value that can be manipulated at runtime. Reification is the core of what makes a language dynamic. Three types of reification in Clojure are discussed.

SOLID Principles in Clojure

The SOLID principles are guidelines for writing good Object-Oriented code. It turns out that these principles are followed and embodied in Clojure.

Why Clojure starts up slowly — is it really the JVM?

One of the most common complaints about the JVM is the long startup time. But what is really taking so long? We analyze some commands to find out.

Tricks for Java interop

There are several features of Java that generate weird classnames. We look at how to refer to them from Clojure.

Try Three Times in Clojure

Distributed systems fail in indistinguishable ways. Often, retrying is a good solution to intermittent errors. We create a retry macro to handle the retries in a generic way.

What is Clojure?

Clojure is a general purpose programming language designed for the fast-approaching future.

What is ClojureScript?

ClojureScript is Clojure that compiles to JavaScript. It combines the power of Clojure with the reach of JavaScript.

Why Functional Programming?

There are many reasons to learn Functional Programming. I go over my 11 favorite reasons. Reason #1 is it's fun!

Why Re-frame instead of Om Next

I had to choose between Re-frame and Om Next when building a course. Here are the reasons why.

Willy Wonka and the core.async Guidelines

There are a few conventions in core.async that are not hard to use once you've learned them. But learning them without help can be tedious. This article presents three guidelines that will get you through the learning curve.

Wrangling Clojure Stacktraces

Clojure error messages and stacktraces are the number one most complained-about feature of Clojure. We look at some tips and resources for dealing with them.

Revenge of the Pragmatists - Baishampayan Ghose

BG has been a part of the Clojure community for a long time. I asked him if he could talk about the reality of building a company on Clojure--the good, the bad, and the ugly of the business-side of things. Recorded at Clojure Sync 2018, New Orleans.

cljs.main - David Nolen

We were honored to have David announce cljs.main, then a new tool to run ClojureScript from the command line. Recorded at Clojure Sync 2018, New Orleans.

apt-get install leiningen - Elana Hashman

What does it take to have a one-command install for Clojure on Debian? Recorded at Clojure Sync 2018, New Orleans.

Building a World Class (Clojure) Team - Rebecca Kinsella

I asked Rebecca to talk about the topic of hiring and getting hired. Funding Circle has built a great team and so they must have a lot of knowledge to share. How do you find good Clojure programmers? What do you look for? What should candidates be prepared for when starting their job search? Hiring is a persistent, perceived barrier to Clojure adoption. This talk should help crack that nut. Recorded at Clojure Sync 2018, New Orleans.

The 5 hurdles of hirability

Find out the two types of jobs that tell you how much you need to learn to be hirable.

5 ways to tweak your resume

5 functional programming ways to impress a hiring manager with your resume.

Are there enough functional programming jobs?

Is functional programming a fad? We cut through the buzz cycle and answer the question once and for all.

Clojure Data Structures Tutorial

Clojure's collections are central to Clojure programming. While in most languages, you might find collections somewhere in the standard library, in Clojure, they are front and center.

Clojure Concurrency Tutorial

From Agents to Executors, this guide covers all of the important concepts for concurrent programming in Clojure. It includes a comprehensive catalog of concurrency primitives.

Clojure Jobs Resources

A big list of sites with Clojure job listings. If you're looking for a job in Clojure, these are the best places to look. Includes many remote jobs.

The Definitive Guide to Clojure on the JVM

The Java ecosystem is big and it can be daunting. But fear not! You don't need to learn everything, and once you learn enough, it will be worth it. You will realize that it is not so intimidating. This guide will be your . . . guide.

Clojure Tutorial

Learn Clojure syntax, set up a development environment, then build a fun project.

Learn to build a Clojure web app - a step-by-step tutorial

Learn to build a Clojure web backend from existing components, step-by-step.

ClojureScript Tutorial

Learn about ClojureScript and how to set up a project using shadow-cljs.

Re-frame Database Best Practices

Your Database is going to contain a lot of important information. When you’re first starting out your app, you don’t know exactly what you’re going to store in there. In addition, you don’t know how you’re going to want to access it. Both of these will evolve over time as you understand more of the domain and you uncover the complexities of your UI. We want some help from the framework (Re-frame) to help us deal with this evolution.

Haskell Jobs Resources

So you want to know who's using Haskell and where to find jobs? You've come to the right place.

What do you really need to know to be hireable?

Find out the two types of jobs that tell you how much you need to learn to be hirable.

How to install Clojure

Easy to follow installation guides for the three main platforms: macOS, Linux, and Windows. This guide shows you how to install everything you need: Java, Leiningen, and the Clojure CLI tool.

Is functional programming a fad?

Is functional programming a fad? We cut through the buzz cycle and answer the question once and for all.

Job application action plan

A complete massive action plan to get a functional programming job.

Join and build a social network

Getting to know people who can help you get functional programming jobs.

Optimistic Update in Re-frame

How do we deal with that little bit of time between when the user clicks and the server confirms the change is saved? Well, like many things in life, there are two ways: optimistically and pessimistically.

10 Programming projects to boost your resume

When NOT to put personal projects in your resume; tips for choosing programming projects; and how to present your projects to maximize your chances.

Re-frame, a Visual Explanation

We look at a sequence diagram to organize the parts of Re-frame.

Re-frame Tutorial with Code Examples

Re-frame adds a beneficial amount of structure to your frontend app. This guide goes over all of the pieces of that structure and how to use them.

How to use React Lifecycle Methods in Re-frame

Learn the 4 React Lifecycle Methods you'll need to know for Reagent/Re-frame and why the other 6 are not needed.

ClojureScript + Reagent Tutorial with Code Examples

Reagent is a ClojureScript wrapper around React. It makes it easy to create React components using functions and hiccup, and state managed in Atoms.

How to leap past 90% of applicants

Josh Doody (Salary Negotiator) and Eric Normand critique a functional programming résumé and give advice for making it better. They also talk about preparing for the interview and the salary talk.

Where to Store State in Re-frame?

This guide goes through the different ways of storing state in Re-frame and how to choose between Re-frame components.

Where do you find the time to get productive in functional programming?

Why we don't need to be productive in functional programming before we get a job.

Timeout Effect in Re-frame

Sometimes you need to delay an Event a certain amount of time. We need to turn setting a timeout into an Effect.

Where to find functional jobs

There has never been a better time to be a professional functional programmer. More and more companies are recognizing the value of functional programming. And companies are more open than ever to a polyglot workforce.

Your functional journey

What are some of the milestones that people hit when they're learning functional programming?

Atom code explanation

I go over a real-world example of how atoms and immutable values allow you to compose constructs in ways that are easy to reason about and less prone to error.

Can building ClojureScript assets be integrated into my build process?

ClojureScript's official build process is a simple shell command. There is also integration into Leiningen and Boot.

How I made my Clojure database tests 5x faster

Setting up and tearing down a test database can be slow. Use a rolled back transaction to quickly reset the database to a known state. You can do that in an `:each` fixture to run each test in isolation.

Clojure HTML Templates

5 features of Clojure let

Clojure let is used to define new variables in a local scope. This article describes a few things you probably know about let, and a few you don't.

Clojure Regex Tutorial

With a few functions from the standard library, Clojure lets you do most of what you want with regular expressions with no muss.

Clojure Routers

How do you choose which Clojure routing library to use in your web app? I share my recommendations and how to decide based on your needs.

All about clojure.set

clojure.set is part of the standard library that comes with Clojure. It has functions for doing set operations and relational algebra.

5 Differences between clojure.spec and Schema

Schema and clojure.spec aim to solve similar problems. There are significant differences, though, that might not be obvious at first.

Where do you put your Clojure tests?

Where to put your tests is a common question. You could put them anywhere, but you want to pick a place that makes it easy to find, easy to exclude from production, and work well with your tools. My recommendation is to follow what most projects do, which takes care of all of these requirements.

Clojure Web Servers

How do you choose which web server to use for a Clojure web application? I share my recommendations. There are two excellent choices—both fast and reliable.

Convince your boss to use Clojure

Clojure has been successfully adopted by many companies. There are many resources available by people who did the hard work of introducing Clojure to their team.

core.async Code Style

If your functions return `core.async` channels instead of taking callbacks, you encourage them to be used within `go` blocks. Unchecked, this encouragement could proliferate your use of `go` blocks unnecessarily. There are some coding conventions that can minimize this problem.

Won't it be hard to debug ClojureScript in my browser?

Even though ClojureScript adds another layer of abstraction, the tooling makes it easier to debug that plain JavaScript.

deftype vs defrecord

There are two commonly used ways to create new data types in Clojure, deftype and defrecord. They are similar but are intended to be used in two distinct use cases. deftype is for programming constructs and defrecord is for domain constructs.

Example-based Unit Testing in Clojure

Unit testing in Clojure is straightforward. Here are a few testing ideas as they apply to Clojure.

Hiccup Tips

Hiccup is a Clojure DSL for generating HTML. If you're using it, you might like these tips.

How can you test ClojureScript applications and libraries?

Although it's still early, ClojureScript is rapidly maturing its testing story. There are a Leiningen plugin and a Boot task for autocompiling ClojureScript as it changes and running tests in a variety of engines.

How to Read Clojure Code Like an Expert

As you get better with Clojure, it becomes easier to read. Why not jump ahead of the learning curve and read like an expert? Focus on the first thing, use the indentation, and read the evaluation order.

How to Use New Relic with Clojure on Heroku

New Relic lets you get more out of Heroku. Install it in 7 steps.

Idiomatic way to represent sum type (Either a b) in Clojure

Infinite Application

Function application is a key concept in lambda calculus. While it is commonly expressed using parentheses in Clojure, it is also reified into a function which itself can be applied to another function.

4 Things Java Programmers Can Learn from Clojure without learning Clojure

JSON Serialization for APIs in Clojure

Clojure is well-suited for processing JSON, but there are some decisions you have to make to suit your application. The major decisions are actually easy, though they took me a while to figure out.

Let's TDD clojure.core/reduce

`clojure.core/reduce` is a powerful function, yet the code for it is so simple. It's four lines! We TDD our own implementation.

Warty Lists in Clojure

Lists are kind of warty in Clojure. Care should be taken, especially by those coming from other Lisps.

Parens vs Brackets in Clojure

Clojure uses both parentheses and square brackets as part of its syntax. It might at first appear to be arbitrary, but it's actually systematic. What's more, it reveals one of the coolest things about Clojure: expressions define how they interpret their arguments.

TDD Workflow in Clojure using Emacs with CIDER

TDD is about fast feedback. CIDER tightens the feedback loop with quick commands for running tests and a powerful test reporting system.

The Ultimate Guide to Learning Clojure for Free

There are many great resources out there for learning Clojure. Some of the resources are paid, but fortunately many of the best resources are absolutely free.

What Web Framework Should I Use in Clojure?

In this guide, I describe the available Clojure web framework options and give my recommendations.

What's the fastest way to get started using ClojureScript?

If you know Clojure already and just want to experiment writing ClojureScript, using Figwheel can really help get you there quickly. I show you how in a few commands.

When To Use a Macro in Clojure

Macros should be avoided to the extent possible. There are three circumstances where they are required.

Where to find time to learn and practice Clojure

Learning any new language is a challenge, and Clojure is no different. Finding the time to learn and practice is a real challenge, so we need to make the most of what time we have. These tips will help you immerse yourself in Clojure.

Learn to build a Clojure web app - a step-by-step tutorial2

Learn to build a Clojure web backend from existing components, step-by-step.