> I wonder what adaptations will be necessary to make AIs work better on Lisp. Some are going to nitpick that Clojure isn't as lispy as, say, Common Lisp but I did experiment with Claude Code CLI and my paid Anthropic subscription (Sonnet 4.6 mostly) and Clojure. It is okay'ish. I got it to write a topological sort and pure (no side effect) functions taking in and returning non-totally-trivial data structures (maps i…
Writing Lisp is AI resistant and I'm sad
71–80 of 104 posts
Re: Writing Lisp is AI resistant and I'm sad
#72Earlier quoted context omitted.
Don’t ask the LLM to do that directly: ask it to write a program to answer the question, then have it run the program. It works much better that way.
If the LLM is intelligent, why can’t it figure out on its own that it needs to write a program?
Re: Writing Lisp is AI resistant and I'm sad
#73Re: Writing Lisp is AI resistant and I'm sad
#74Everything in this area is moving so quickly that I haven't yet crystallized my thinking or settled on a working methodology but I am getting a lot of value out of running Claude Code with MCP servers for Common Lisp and Emacs (cl-mcp & emacs-mcp-server). Among other things this certainly helps with the unbalanced parentheses rabbit hole.
Along with that I am showing it plenty of my own Lisp code and encouraging it to adopt my preferred coding style and libraries. It takes a little coaching and reinforcement (recalcitrant intern syndrome) but it learns as it goes. It's really quite a pleasant experience to see it write Lisp as I might have written it.
Re: Writing Lisp is AI resistant and I'm sad
#75Earlier quoted context omitted.
I bet it would do much better at hcl (or Starlark, maybe even yaml, something that it has seen plenty of examples of in the wild). This is a weird moment in time where proprietary technology can hurt more than it can help, even if it's superior to what's available in public in principle.
Depends if the AI masters also own said proprietary technology.
Who owns the tech doesn't matter, what matters is whether there's a set of diverse examples of its use spread around the internet.
Re: Writing Lisp is AI resistant and I'm sad
#76Earlier quoted context omitted.
Depends if the AI masters also own said proprietary technology.
Well, GCL is (afaik) a Google technology, and they do have some kind of internal, fine-tuned models just for their stack. Who owns the tech doesn't matter, what matters is whether there's a set of diverse examples of its use spread around the internet.
That's the reason I think it honestly depends more on the complexity to understand and the necessity of having a mental model of the code.
Re: Writing Lisp is AI resistant and I'm sad
#77Earlier quoted context omitted.
Sometimes LLMs astonish me with what the code they can write. Other times I have to laugh or cry. As an example, I asked claude 3.5 back when that was the latest to indent all the code in my file by four more spaces. The file was about 700 lines long. I got a busy spinner for two minutes then it said, "OK, first 50 lines done, now I'll do the rest" and got another busy spinner and it said, "this is taking too long. I…
That's you at the time not knowing LLM fundamentals with regards to context management.
Re: Writing Lisp is AI resistant and I'm sad
#78I wasn't sure if I should expect great results relative to more popular languages with more code for the LLM to train on, but it looks like that's either not a big issue, or Clojure is over the popularity threshold for good results. I also previously expected languages with a lot of static guarantees like Rust to lead to consistently better results with LLM coding agents than languages like Clojure which have few, but that's untrue to the point that "bad AI rewrite in Rust" is a meme.
Re: Writing Lisp is AI resistant and I'm sad
#79Wildly speculating here, but if you buy that human brains have innate / evolved syntactic knowledge, and that this knowledge projects itself as the common syntactic forms across the bulk of human languages, then it’s no surprise that LLMs don’t have particularly deep grooves for s-expressions, regardless of the programming language distribution of the training set.
OK, I'll bite. I want to know more of the reasoning behind this, because I think it implies that S-expressions are alien to the innate/evolved syntactic knowledge in human languages. A lot of American linguistics, like Chomsky's gropings for how to construct universal grammar and deep syntax trees, or the lambda calculus of semantic functions, looks like S-expressions, and I think that's because there was some coordi…