Vibe Clojure

I’ve been writing a Clojure in Rust.

Share

I’ve been writing a Clojure in Rust.

I’ve been using Claude Code to do a lot of the work here, and it seems to be pushing it to its limit; I do have a partial Clojure dialect that can (in interpreter mode) run a significant test suite successfully.

I was reading about how Clojure was an excellent language for machine-generated code, meaning AI agents, since its structure is so well-defined, syntax so simple, and overall so powerful and concise that it makes for very efficient token usage when generating code. I’ve also been learning Rust, only because it’s been the hot new language for a while, and it’s a good feeling to finally “get” what a language is about. I think I grok what the borrow checker is doing and why it’s important, and how to write your code to respect it.

But I got to thinking: what if we could combine Rust’s runtime with Clojure’s coding efficiency? Clojure and Lisp need garbage collection to operate in general, but that’s clearly not always the case for all functions. A pure function where the argument is consumed and only the output escapes seems like it could be highly optimized to do RAII-style allocation and deallocation: once called, the input (if never used again) and any temporary values created by that function are no longer needed, so they can be safely discarded — or even better, just stack-allocated.

Plus, what if we offer a JIT? Or AOT-compilation? And Rust interop? What could this unlock when writing an optimized, memory-efficient program is as easy as a Lisp?

I’m trying to document this journey, and maybe produce something useful. AI tools are very far from perfect, but I’m curious how far they can go when there’s someone in the driver’s seat.

Code: https://github.com/csm/clojurust.