r/lisp • u/nderstand2grow λf.(λx.f (x x)) (λx.f (x x)) • Mar 23 '24
Help How's the state of Copilot code suggestions for Lisps (Common Lisp, Scheme, Clojure, etc.)?
I came across this comment on HN: https://news.ycombinator.com/item?id=35478991
Which makes me wonder if languages that lack the macros feature could benefit more from LLMs because the AI learns some predefined idiomatic patterns from its training data which can be helpful when writing in those languages. But things like Lisps with their own macros and DSLs might be challenging for the LLM because the LLM has to learn from the examples in your code base to learn your specific DSL, and it's not going to be as effective of a learning.
Not to mention the negative feedback loop that exists for languages that were already popular before LLMs (Java, Python, JS). More training data for those languages means higher quality code generated by the LLM, whereas Lisps have been less popular, which means they unfortunately will get even less popular over time as people get better AI assistance for mainstream languages.
15
u/SWMRepresent Mar 23 '24
It cuts down on menial typing, but it often makes mistakes (if you can even call inability to read my mind a mistake…).
It’s quite good with generating doc strings, but again, it will only describe the mechanics of what is going on, rarely the meaning and purpose.
Bottom line - you still have to know what you’re doing.
9
u/cdegroot Mar 23 '24
Call me skeptical until I see an AI refactor code because the requirements changed and/or insights changed and therefore the code needs to be in a different shape. I don’t think that that will happen anytime soon whether it is for Python or for Lisp. Might be wrong of course, then our language would finally be English for interacting with a computer. I would not mind, frankly.
7
u/defmacro-jam Mar 23 '24
Claude 3 Opus is a pretty good lisper.
6
u/NefariousnessFit3502 Mar 23 '24
Probably worse than for mainstream languages and it's pretty bad there in the first place.
5
u/muyuu Mar 23 '24
i have only tried it a few times but it makes so many mistakes it's mostly a distraction, at least for scheme
i suspect Common Lisp may be better since CL macros are so much syntactically simpler than R5RS and similar
5
u/svetlyak40wt Mar 23 '24
Today I've asked LLM to generate HTML for a simple landing page. The requested a few changes, and it refactored the code. After that I've asked to transform this HTML to s-exprs which can be used in Common Lisp Spinneret library, and it did the job!
Also previously I had experience of generation small codepieces for calling C functions using CFFI. Often LLM generated a code with wrong symbols but anyway it was a good starting point.
2
u/bmiww Mar 24 '24
Mostly need to review whatever comes out of it. Can reduce a bunch of boilerplate work.
Does not like the CL (str:substr). Consistently inserts the argument meanings incorrectly (and I usually miss this causing a pretty long debug session)
2
u/dbotton Mar 24 '24
One of Lisps super powers is that generative AI will likely never work for it. Forcing humans to us RI (real intelligence) and allow me to make creative and far superior products.
One more win for Lisp!