I used to love writing custom CSS, but Claude is just so much better at Tailwind that I ended up switching, even though I still kind of loathe the class soup.
Is AI any good at Clojure?
It's okay when you use it just like any other PL, which is roughly the Unix/pipe model - batch-style. Agent spawns process -> reads stdout/stderr -> spawns next process. State lives in-between the calls and in files. Each tool invocation is stateless.
Things get far more interesting when you give an LLM a true Lisp REPL. LLM stops guessing and starts empirically analyzing current state of things and produces working solution faster, costing far less tokens. And you get to watch it solve things interactively, e.g. I often let AI poke through our UI (via Playwright-driven Clojurescript REPL), while monitoring situation in k8s - through nrepl port, connected to Clojure REPL.
Clojure meanwhile is very terse without being unreadable. It really does read like a series of data transformations.
Recently, I’ve been quite impressed, at least with Claude. At some point they figured out the parens issue, and the code is largely solid and idiomatic. I’ve mostly used it with Polylith apps, so the context for any given change is naturally well-defined. Usual issues with failing to reuse existing functions or make sound decisions about architecture, but no more so than I’ve seen with TypeScript or Rust.
I think there are a few points in its favour: it’s a very concise language, the documentation is terse but precise and comprehensive, and while there’s obviously nowhere near as much Clojure out there as there is JavaScript or Python, there is a lot. As the Clojure demographic skews toward experienced, senior programmers, I’d guess the quality of that corpus is probably well above average.
Java stack trace errors might even be an advantage now.
For Biff I've been using AI to generate a rough draft of all the code and then I take a manual pass over things before releasing. Seems to be a good middle ground.
I have migrated all my code to Gleam, FE and BE, Bun, browser, and BEAM.
Claude knows much less about Gleam than it does about Javascript or React. However the constraints of Gleam and its Elm inspired framework Lustre are so strong, Claude gives me much better results.
The only difference is I need to adjust my initial guidance.
I've always admired the direction gleam was heading in, and the community is awesome. But with gradual typing now in elixir, I'm weighing whether or not gleam offers anything special enough to get me spending time there instead of just using elixir.
My impression is that I voiced a valid concern. I suspected handling parentheses is problematic.
The most infamous two letters of our time - humans do not like machines, and absolutely hate those who do.
> I voiced a valid concern
Not unwarranted. When you treat a homoiconic language just like any other, LLMs do sometimes get messy with paren-balancing, but most models correct it on a second-third try. You still get some benefits - e.g., Clojure is the most token efficient mainstreamish PL.
To get the most benefit from it, one must teach the model to treat it just like a human programmer would. It makes no sense to treat Clojure like Python or Go, or C - it's like ordering a pair of swim fins and jumping into water with the unpacked box. Lisp dialects shine when you use the REPL (true Lisp REPL - not some faux-repl like Python's), so you have to "teach" the model a way to operate the live REPL, not passively reading/writing "static" code that's fed into it batch-style. When you do that, models not only get much better grasp of where the syntactic elements should be, they start reasoning about the program in a way more interesting fashion, empirically evaling pieces on the fly, interactively - without juggling state, without compiling, without even having to save things (until proven to work).
Does that make Clojure "the best LLM-suited PL"? Not really - there's simply no such thing. For sure though, the homoiconic nature of the language absolutely makes it enormously interesting and well-suited for it.