Author: Stuart

Clojure Don’ts: Thread as

A brief addendum to my last post about Clojure’s threading macros. As I was saying … I said you could use as-> to work around the placement of an argument that doesn’t quite fit into a larger pattern of ->. My example was: (-> results :matches (as-> matches (filter winning-match? matches)) (nth 3) :scores (get…

Read the full article

Threading with Style

No, not multi-threading. I’m talking about Clojure’s threading macros, better known as “the arrows.” The -> (“thread-first”) and ->> (“thread-last”) macros are small but significant innovations in Clojure’s Lisp-like syntax. They support a functional style of programming with return values and make composition intuitive. They answer the two chief complaints about Lisp syntax: too many…

Read the full article

Building for Growth at Clubhouse

A couple of weeks ago, I sat down with my new coworkers Camille Acey and Paul Groudas to talk about the work we’re doing to scale up and expand The interview is on the Clubhouse blog as Building for Growth: A Conversation with Clubhouse’s Paul Groudas and Stuart Sierra.

How ’bout that start-up time?

How long does Clojure start-up really take? Let’s find out. Get yourself a Clojure project. Download the dependencies and pre-generate the classpath: lein deps lein classpath > cp.txt This lets us run “raw” Clojure, without any tooling. Assuming a Bash-like shell: time java -cp “$(cat cp.txt)” clojure.main -e ‘(System/exit 0)’ Now add Leiningen: time lein run…

Read the full article

Clojure Don’ts: Non-Polymorphism

Polymorphism is a powerful feature. The purpose of polymorphism is to provide a single, consistent interface to a caller. There may be multiple ways to carry out that behavior, but the caller doesn’t need to know that. When you call a polymorphic function, you remain blissfully ignorant of (and therefore decoupled from) which method will…

Read the full article

Developing the Language of the Domain

Earlier this year, I wrote a piece for the Cognitect blog: Developing the Language of the Domain ( In it, I describe the process of building a domain-driven application using Clojure, ClojureScript, EDN, Datomic, clojure.spec, Pedestal, and Om.

How to ns

Quick link: Stuart’s ns Style Guide Everyone has their own personal quirks when it comes to syntax. No matter how hard you try to lock it down with code review, IDEs, scripts, or check-in hooks, individual differences will emerge. In Clojure the situation is generally pretty stable: most people follow the same general patterns, which…

Read the full article

End of the Free Lunch

I’m part of that awkward, in-between cohort, a little too young to fit in with Gen Xers but — although we grew up with computers like our younger siblings, the much-loathed Millennials — still old enough to recall life before the Internet. The Oregon Trail Generation still remembers, dimly, the screech of a dial-up modem…

Read the full article

Apathy of the Commons

Eight years ago, I filed a bug on an open-source project. HADOOP-3733 appeared to be a minor problem with special characters in URLs. I hadn’t bothered to examine the source code, but I assumed it would be an easy fix. Who knows, maybe it would even give some eager young programmer the opportunity to make…

Read the full article

Fixtures as Caches

I am responsible — for better or for worse — for the library which eventually became clojure.test. It has remained largely the same since it was first added to the language distribution back in the pre-1.0 days. While there are many things about clojure.test which I would do differently now — dynamic binding, var metadata,…

Read the full article