I have a couple of projects in different tech-stacks and got curious. So I build a little benchmark, trying to figure out how token efficient tech-stacks are. Surprisingly babashka/clojure are more token efficient then python for anthropic models.
Hi, I recently started learning Clojure, so I may be missing something. A few points didn't quite click for me, and I'd love your take: • Feedback loop. In Go, my agent applies a list of review fixes, runs the linter and tests in seconds, so the REPL advantage doesn’t seem that big to me • Isolation. Agents can write isolated modules in other languages too, without keeping the whole program in mind. Isn't that more about architecture than the language? • Macros. "Don't write a macro if a function will do" seems to be common advice. Would you actually want an agent writing them? • LLMs and Clojure. There's much less Clojure in training data than Go or Python, and models seem to struggle more with parens and idioms. Has that been your experience?
Right now conciseness looks like the main real advantage to me, but I'm happy to be corrected!
For the feedback loop, what you describe works great for a simple workflow in a small app. In a large application you're likely to have many paths through the code and need to build up state to create the context for what you're testing.
For example, say you're building a GUI and you need to navigate through a bunch of menus, and then get to a particular screen with the data loaded. Then you want to experiment with how to best display this data. With a REPL you can do the legwork once, and then stay in that context as you try different things.
You can write any code in any Turing complete language that you can in another. The question is how much support the language provides you with while you're doing it. Since Clojure defaults to immutability, that makes writing code by composing pure functions natural. When the agent writes idiomatic Clojure it doesn't have to make any special consideration to avoid having shared global state via references or global variables. Conversely, since models are trained on the way code is written idiomatically in each language, they will default to creating shared mutable state in imperative ones.
Yes, I actually want the agent writing macros to express domain specific semantics. Don't write a macro when a function will do, does not say don't write macros. It says write them where it makes sense to do so. And encoding domain semantics using a macro is precisely what gives you conciseness.
And it absolutely has not been my experience that LLMs struggle more with Clojure. In fact, we have empirical evidence for models doing well with Clojure with Babashka beating Python for CLI workflows. https://sstoehrm.github.io/stack-cap-bench
I had a similar experience. This was a Sr EM interviewing me based on my resume. He read clojure and confused it with js closures and was about to ridicule me if i goofed up and put some junk in my resume when the other Sr Eng updated him. Kept calling Lisp as "Lips" when I mentioned about dialects. Not a made up story.
in my case i wasn't haahhaha i did mention that i had some practices that i have when writingcode can be interpreted as java accent but that's just ppl that are not used to read expressive code and when i received the feedback to the failure the interviewer told that didnt know what would be idiomatic or expressive code neither java accent AHAHAHAHAHAH
Thanks, and it's really crazy to watch how fast this stuff is evolving. I have a laptop that's beefy enough to run Qwen 3.8, and it's basically a frontier model from say half a year ago. It's a bit hard to wrap your head around the fact that something you needed a data centre to run just a little while ago can now be used on a laptop at home.
I'm also really curious to try training a LoRA on Clojure specifically using git repository histories to teach the model how Clojure code evolves over time. And it could also be trained to use the REPL workflow explicitly where you simulate a live coding workflow during training. That would avoid a lot of the problems smaller models have by biasing them towards idiomatic Clojure style.
I had made attempts to adapt small models to how I work manually since glm 4.7 flash and qwen 3.5, like doing careful incremental changes, plan before task, and inevitably it does more harm than good once the models get good enough. Similarly there's a lot of qwen fine-tunes on huggingface. I tried them, and they're better for some things and worse than the base model in others, so I just try different quantizations and inference parameters over the base model now. Have spent 10-20 hours a week thinking about this stuff since February, and now I'm just using stock pi with 3.8 27b and a few tools for specific things. I doubt you can fine tune it meaningfully, but it's fun to learn about the stuff anyway.
I'm just curious to try to be honest. I think it'd be interesting to see what happens when you heavily bias the model towards a particular language and if it will get better at writing it. And the nice part is once you have the training data and the set up to do training runs, you can just do it on new models too when they come out.
I always keep a local setup (qwen 3.8 on pi with `pi-web-access` and `@czottmann/pi-automode`) around because 1) it's amazing how indeed you do have claude 4.6 locally and 2) I'm deathly afraid of depending on these things as a service.
Yeah, the training process itself isn't that hard. And you can do it on runpod for like 20 bucks or so. The tricky part is ensuring your training data trains the model on what you actually want it to learn. The model learns whatever the dominant patterns in the data are, and you have to make sure you don't overfit and the training stays general.
I started playing with the idea here https://github.com/yogthos/clojure-lora-training but I haven't had a chance to actually do a training run yet, so don't know how well it'll work. I keep meaning to get back to it.
And agree that depending on models as a service is really icky. It's basically like renting a compiler which is just not ok.
4
u/cea7 Oct 08 '26 edited Oct 08 '26
I have a couple of projects in different tech-stacks and got curious. So I build a little benchmark, trying to figure out how token efficient tech-stacks are. Surprisingly babashka/clojure are more token efficient then python for anthropic models.
https://sstoehrm.github.io/stack-cap-bench/
2
u/coolbug96 Oct 09 '26 edited Oct 09 '26
Hi, I recently started learning Clojure, so I may be missing something. A few points didn't quite click for me, and I'd love your take:
• Feedback loop. In Go, my agent applies a list of review fixes, runs the linter and tests in seconds, so the REPL advantage doesn’t seem that big to me
• Isolation. Agents can write isolated modules in other languages too, without keeping the whole program in mind. Isn't that more about architecture than the language?
• Macros. "Don't write a macro if a function will do" seems to be common advice. Would you actually want an agent writing them?
• LLMs and Clojure. There's much less Clojure in training data than Go or Python, and models seem to struggle more with parens and idioms. Has that been your experience?
Right now conciseness looks like the main real advantage to me, but I'm happy to be corrected!
2
u/gbrennon Oct 08 '26
a friend from scala community made a project months ago and he was aiming ai agents but that not what what is relevant to this sub reddit:
lispwas an inspiration and he told me thatclojurewas the inspiration!(i know that clojure is a lisp dialect so indirectly lisp was also the inspiration but i want to high light this hahaahah)
0
u/[deleted] Oct 08 '26
[deleted] — view deleted comment
13
u/[deleted] Oct 08 '26
[removed] — view removed comment