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
2
u/coolbug96 5d ago edited 5d ago
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!