• Clojure

Filed under:


I learned about Clojure sometime in early 2017 from one particularly kind soul who ran a few programming meetups in Toronto. I tossed myself into the deepend, joining a startup in the fall of 2017, where everything was built with Clojure. This page holds some of the random things I've learned about Clojure / often need to re-search when I'm building something.


GraalVM can be used to compile native-images with Clojure code (among other things). I use it to compile the Firnº project into a single binary. Getting Clojure (specifically, handling typing and reflection) to work with Graal can be tricky. These are some resources that have helped along the way.


  • Debugging javax.xml.bind.DatatypeConverter when building for Linux.

  • A GraalVM web example with Clojure

  • Getting Java/Clojure to talk to Rust / Other languages - Example Repo

  • See the section below on type hinting

  • Reading compile scripts / options on existing codebases: Sci and Babashka

Type Hinting

I often forget how to type-hint different forms in Clojure. I usually only end up doing this when using GraalVM.

;; Type hinting the let binding
(let [^String s (something-returning-a-string)]
  (.isEmpty s))

;; Type hinting a function parameter
(defn empty? [^String s]
  (.isEmpty s))

;; Type hinting a Java Interop method call.
(.isEmpty ^String (something-returning-a-string))

;; Type hinting a return value on a function
(defn ^String myfn []
  "I'm a string")

;; A multi arity type function return
(defn myfn2
  (^String [] "I'm a string")
  (^String [a b] "I'm a string too"))

src: Performance nemesis: reflection - Clojure Goes Fast


Quil is a Clojureº wrapper for the Processing library. The Construction (Priest)º series was built with Quil. Using Quil for Artwork is a neat and useful read.

The Question Stack

A list of clojure-specific questions & answers I've found while coding.