Jim Cheung

Clojure (*new)

My clojure page is 7 years old; it's time for an update. I'll keep the old page as a reference.

There's already an official guide for getting started. Here is just my opinionated clojure setup.

lein

I no longer use lein, but I agree that it's easier than deps.edn (like lein new and lein uberjar etc.)

for usage can read Clojure for the Brave and True

babashka and friends

babashka is a game changer. It's fast, single binary and battery included. I use it for all my personal scripting.

not only that, I also try to use babashka libraries like fs, process, http-client in clojure as well.

read the book to learn more about babashka.

project setup

I have a project skeleton for quick start. It is created by another babashka friend: neil

neil handles setup for dependencies, build(uberjar), tests and nrepl.

reference: New Clojure project quickstart

editor and repl

repl-driven development means connecting your editor to the repl, not opening the repl and typing on it. Setting up your editor and the REPL is crucial.

I'm using emacs with cider, but it's easy to setup for other editors.

Learning Clojure

before I had questions such as "why doesn't clojure have pattern matching?" or "where can I find a library that implements the actor model?"

I recently found the answer after watching Simple Made Easy again:

Simple Made Easy

I believe this table is important; it represents the thinking behind Clojure


Tutorials often discuss map, filter, and reduce as important functional concepts. However, I believe the following are also important:

  1. Destructuring in Clojure
  2. Datatypes: deftype, defrecord and reify
  3. Multimethods and Hierarchies
  4. Protocols

I highly recommend a book that differs from others, starting not with map/filter but defrecord: Clojure Applied