为什么通用 Lisp 是当今最好的编程语言
Why Common Lisp is now the best programming language

原始链接: https://www.vivienhenz.com/common-lisp

这篇文章认为,Common Lisp 可能是最适合 LLM 辅助编程的语言,因为它能缩短反馈周期。它采用基于映像的开发方式,无须重启即可更新函数;出现错误时,还可以直接进入交互式调试器,查看调用栈和变量。这让 LLM 能够检查问题、修改代码,并立即恢复程序运行。 由于代码和数据都采用相同的列表表示形式,Lisp 能够提供强大的宏,从而用领域特定抽象扩展语言。因此,企业可以把其产品理念直接编码到语言中,帮助用户安全地定制 ERP 等系统。宏还可以大幅精简大型程序——据称,其代码长度可能只有 Python 版本的六分之一或七分之一——从而降低 LLM 的令牌成本,并让更多程序内容保留在上下文中。 作者也看重 Common Lisp 自 1994 年以来一直保持的稳定性,以及其较小的依赖生态系统,这降低了供应链风险。尽管熟悉 Lisp 的工程师不多,相关的包生态系统也相对有限,但当 LLM 能够编写、移植和维护代码,而优秀的工程师又能快速掌握这门语言时,这些缺点可能就没那么重要。

一个 Hacker News 讨论帖围绕文章《为什么 Common Lisp 是最好的编程语言》展开。该文章认为,Common Lisp 尤其适合 AI 辅助开发:它拥有强大的宏,可以将特定领域的产品决策编码其中;代码简洁;交互式调试器还能展示栈帧和变量,使 LLM 无需重启程序,就能诊断问题、修改代码并继续执行。 许多评论者质疑这种语言的独特性,指出 C#、JavaScript、Python 的 PDB 和 Smalltalk 也具备类似的调试能力。其他人则质疑交互式调试在生产环境中是否现实,尤其是对于 Web 服务器,暂停调试可能导致请求或进程被冻结。有人还提到 Erlang 也是一个有用的替代方案,不过它的故障处理更依赖于让参与者崩溃并重试,而不是在运行过程中进行检查和修复。 怀疑者还 challenges? Need translate: "也质疑宏和自定义 DSL 能减少 LLM token 消耗这一说法,因为仍然必须提供文档和上下文,而 Common Lisp 较小的生态系统也可能带来额外的维护工作。总体而言,讨论认为这一观点有趣,但缺乏充分证据支持。" Need no extra. Ensure "challenges" no. Let's formulate all Chinese.一个 Hacker News 讨论帖围绕文章《为什么 Common Lisp 是最好的编程语言》展开。该文章认为,Common Lisp 尤其适合 AI 辅助开发:它拥有强大的宏,可以将特定领域的产品决策编码其中;代码简洁;交互式调试器还能展示栈帧和变量,使 LLM 无需重启程序,就能诊断问题、修改代码并继续执行。 许多评论者质疑这种语言的独特性,指出 C#、JavaScript、Python 的 PDB 和 Smalltalk 也具备类似的调试能力。其他人则质疑交互式调试在生产环境中是否现实,尤其是对于 Web 服务器,暂停调试可能导致请求或进程被冻结。有人还提到 Erlang 也是一个有用的替代方案,不过它的故障处理更依赖于让参与者崩溃并重试,而不是在运行过程中进行检查和修复。 怀疑者还质疑宏和自定义 DSL 能减少 LLM token 消耗这一说法,因为仍然必须提供文档和上下文,而 Common Lisp 较小的生态系统也可能带来额外的维护工作。总体而言,讨论认为这一观点有趣,但缺乏充分证据支持。
相关文章

原文

Would you agree that some programming languages are better than others? If so then one of them must be the best. And it’s actually Common Lisp especially now that LLMs can write code.

LLMs write code really fast, and that changes a lot, because writing code used to be the slow part. Now the slow part is finding out if your program actually works, and before you can do that you have to rebuild it, which can take a few minutes.

When humans wrote the code this didn't matter much, because writing took way longer than waiting for it to compile and start running. But now it does, so how long your feedback loop takes is what decides how fast you can build.

In Common Lisp that loop almost doesn't exist because there is no real distinction between read-time, compile-time, and runtime (Graham). Common Lisp is image-based which means that your program is a live image in memory, so a new version of a function replaces the old one right away without having to restart anything.

Also, in most languages an error will crash your program. So if you’re writing code with an LLM it will have to read your crash logs to make some changes and run your program again. In Common Lisp your program won’t crash, it’ll stop and open a debugger with the whole stack and all the variables. You can just point your LLM at the debugger, and it’ll make its fix and resume the program.

To my knowledge Common Lisp is the only mainstream language that does all of this.

Lisp stands for "List Processing." In Common Lisp, code is written as lists. For example, (+ 1 2) is a program that adds two numbers, but it's also just a list of three things: the symbol +, and the numbers 1 and 2.

What's interesting is that this is the same kind of list Common Lisp uses to store data, and since the language is built around processing lists all its tools for working with data also work on code. So a program can take another program and change it, for example it can turn (+ 1 2) into (* 1 2), and run the result right away.

This is what makes macros possible. A macro is a function that takes your code and returns new code in its place, that means you can add new constructs to the language itself.

Once you can add to the language, you can build it up toward your problem. So in Lisp you don't just write a program, you write a language for your domain and then write the program in it.

That matters a lot more now, because what makes a program valuable is the opinions behind it. And we're heading toward a world where software companies let their users change the product themselves, since with an LLM that's easy. So if a company builds a good opinionated domain language for its product, everything its users build on top of it will be much better, because they start from the company's opinions and not from scratch.

Take an ERP. Every company runs a little differently, so almost everyone ends up needing to change it. But if the ERP is written in its own domain language, you can just ask an LLM to make the change in that language. The change will naturally follow the domain language’s underlying opinions, so it fits the product instead of breaking it.

And it's not just better, it's also cheaper. Lisp programs are often much more concise because macros let you abstract away recurring patterns and make them part of the language itself. So the bigger the program gets, the bigger the difference. In my own experience the apps I've built in Common Lisp end up about six to seven times shorter than the Python versions.

For LLMs, less code means fewer tokens, and tokens are what you pay for so you spend less on development.

It also means a bigger portion of your program can fit in the LLM's context window. If your LLM has your entire program in its context window then it has a complete view of your intent, which leads to it making better decisions. In my experience a lot of LLM bugs stem from it changing one piece of my program without seeing the rest. So with Common Lisp that happens less often.

Common Lisp is an ANSI standard and it hasn't been updated since 1994. I like this feature. And going back to our ERP example, if your users change the product themselves, that's exactly what you want since the language underneath never moves and nothing they build on top of it ever breaks.

When you write a program in Common Lisp you often won’t be able to find a library you need. Quicklisp, the main Common Lisp package manager, has a couple thousand projects while npm has millions.

But I don't think that's a problem anymore. Most programs today depend on millions of lines of code from packages that keep getting compromised. You don’t want that in yours. Also, with an LLM you could just write the part you need yourself or port the whole library — and LLMs seem to be really good at porting code.

Lastly, I'm seeing now that a lot of people are programming now in the hope of building a business. An obvious objection to building products in Common Lisp is that you’ll have a hard time finding engineers since so few people know how to program in it.

But I don't think that really matters now. If you want to build a successful company you want to hire the best technical people: the ones who are really good at learning new things. So in your coding interviews just make them learn Common Lisp, and there you go. You'll see how fast people pick things up, and the ones who do well will probably keep learning it and get really good at it.

In conclusion, next time you want to write a program use Common Lisp.


Works Cited

Graham, Paul. "What Made Lisp Different." Paul Graham, May 2002, paulgraham.com/diff.html. Accessed 5 Oct. 2026.

联系我们 contact @ memedata.com