Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GraalVM dive in Clojure at work


I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

GraalVM CLIs

I looked through and tried a number of CLIs and found the following three to be the most useful.

jet is a handy tool for slicing and dicing json or edn. It is similar in functionality to what jq provides for json but with possibly more power and a clojure syntax.

I found jet has a sweet spot for exploring and drilling into api responses. I was able to use a github api to print the PR for a commit and open it. Here is that script:

$ curl -H 'Accept: application/vnd.github.groot-preview+json' -s '' | jet --from json --keywordize --query 'first :html_url' |xargs open

clojurl is a curl-like tool that can make web requests. Unlike curl, the response come back as a data structure and can be easily manipulated with something like jet. This seems it could be useful when working with APIs.

babashka is the most promising tool as it provides a graalvm speed interpreter for a subset of Clojure. This tool can be used for concise one-line scripts or more impressively for Clojure scripts to replace shell scripts. It supports a number of standard libraries including tools.cli for option parsing, can make https requests and comes with a repl.

In order to build something useful for work and to test how useful babashka is, I wrote this script which expands on the above one-liner with jet by providing authentication, error handling and git repository detection. For command usage see the readme. I found the development experience to be super helpful as I could try small things in the babashka repl as well as rerun the script at lightning speed.

Additional CLIs

These are graalvm based clis that look interesting:


Graalvm tooling for Clojure has gotten noticeably better the past 12 months. Clojure community is starting to build some useful clis with graalvm. Writing fast Clojure clis is easy to do with clj.native-image. However the compile times are slow and distribution for a team takes additional effort. To overcome those pains you can use babashka for faster development cycles and an easier distribution story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.