4xel
Joined 4 months ago
Joined 4 months ago
It's a purely theoretical and speculative advantage as of now. Human lisper think in AST, that's something powerful, and it's reasonable to assume an AI could too, with benefits. But LLMs simply don't; not only they will occasionally mismatch parens, but they will dig themselves in a pit when asked to fix it. Stronger models miss far fewer parens, but that's most likely that they adapt better, not that they think in s expressions ASTs. But we could totally imagine transformer producing directly ASTs, and lisp is probably the best first target for that.
I've found macros and live programming to be much of the same: it'll do it when asked to, but is not particularly natural or apt at it. They can use macros well, but will rarely choose to write the correct macro when needed.
Live programming feel particularly ill-suited: multiplying small request with an accumulating context sounds like a sure fire way to explode your token budget. It does wonder for humans because we're able to compress our "context" on the fly. Context caching may mitigate all or most of it, but then it make compressing context less worthwhile. As much as I dislike it, LLMs are punch-card programs suited punch-card programming (write/read all in one go, then compile and execute); his entire training set is arguably punchcard, even from live programming languages.
> shouldn't we have the LLM generate Erlang?
Unironically a good idea
In mainstream languages, the closest thing to the "living system" part of lisp that I personally grasp and love is not debbuggers; it's Jupyter Notebooks, SQL sandboxes in DBMS UIs, and scripting, as in shell scripting. Still, given the choice, I prefer the Emacs+lisp experience over these great tools.
Also, live programming is not something lisp overspecialize in, like could be argued for most of the aforementioned tools. Rather, it incorporates it seamlessly. In visual studio, I can run a program line by line or with breakpoints. In lisp, I can select which s experession(s) I want to compile or execute, while an LLM agent is connected to the same image and doing stuffs in the background.
I do not merely get any single potential benefit of dynamic languages, I get all of them at once, even when working on a source file perfectly suited for punchcard programming (read compile execute).
Still, I don't think it's wrong to say LISP is for the elite. It is harmful when it's implied it's only for the elite, but being for the elite is not exclusive with being easy to learn, or being good for newcommers.
Heck, lisp minimal syntax is probably what bridges the two, and it (s expression, and lack of m expressions) was explicitly petitioned for by early lispers, for reasons which likely make them a similar elite than present day lisp enjoyers.
Likewise, appeal to the masses does not equate ease of learning, or even anti-elitism. It certainly is a common marketing point, but familiarity is what really matters. Emacs has never been so good, Microsoft Office is a good decade or two deep in enshittification, and guess what modern day secretaries use?
> Invariant: From this point on the array’s length must be 3N + 1 for some integer N.
Invariant can be checked by code, and they definitely should if your language allows constraints or asserts (checked at comptime or ran in test and debug mode)
> We use simple brute force here because instances are guaranteed to be small (see guard above).
The guard above probably conveys the information already.
> Limit each request to one day’s data; otherwise, we won’t get 1-minute resolution.
This could be a benchmark, though I wouldn't be unhappy to read this as a comment, and I wouldn't care if there was no benchmark.
A couple others could be in a separate technical doc rather than in comment. I'm on the fence about it, a bit more on your side, but there are ways and places to express intent outside of the source code that the "no comments" crowd may argue for.
As for the python example, it's a great illustration of your point, there are many comments, but it's hard to remove any. Still:
# Weights must be non-negative integers. and # The distribution must have a positive total weight.
Can be discarded without losing anything: the parameter validation they comment is already transparent, and even includes natural language in the error message, describing what happens why.
Some other comments describe the what rather than the why, but the code it refers to is dense enough that it's warranted.
But for those who do choose Emacs for its supreme hackability, I got a hunch that their profile is very similar to those who choose lisp for its unmatched meta-programming ; they're also very similar to the OG lispers who actually rejected M-expression, the normal, more mathy syntax with less parens, and embraced S-Expressions, precisely because (= code CST AST) is what gives lisp its simplicity and powers in the first place. It's not that we are stuck with parens anyway, the initial vision of lisp, with far fewer parens, has been implemented in Rhombus for example; and we don't even have to change language, 1 or 2 days of writing macros is all it takes to get your favorite lisp to understand many expressions without brackets, and even remove many brackets from existing code; for example, I'm using something close to https://www.reddit.com/r/lisp/comments/18b6hf/comment/c8d8wt... to write your example as (Too $ many $ god $ damn $ brackets), which btw, doesn't use any less brackets in an Algol language: Too(many(god(damn(brackets())))) (but yeah, in many circumstances, we do use more).
This is why I have a hard time imagining an "emacs spawn" not written in lisp. Before even considering that many Emacs concepts are most easily transcribed in a lisp, who would be interested in writing and using it in the first place? (genuine question)
Thankfully for people disliking lisp, and you are many, there are also plenty of great editors which share some of Emacs strength, while being neither written in lisp nor Emacs copies https://www.reddit.com/r/emacs/comments/kzymtd/are_there_oth...
Edit: apparently, (some) emacs lovers disagree with me, saying emacs can be emacs even without lisp: https://www.emacswiki.org/emacs/Emacsen
And even provide a list! https://www.emacswiki.org/emacs/EmacsImplementations
What language do you have in mind?
If you're worried about performance, Common Lisp is a compiled language. It's about the best performing dynamic language there is, and not too far behind Zig, Rust and the likes.
This is a separate issue. You give great advice for both humans and LLMs, and anything in between, but the fact that it misses parens at all demonstrates it is not reasoning at the AST level, at least not directly, and that's the point the person your replying to is making.
An hypotetical NN trained to produce valid AST would most likely never get it wrong, it would likely even be given the whole stack of opened context as its input to generate the next token, not just the preceding text tokens, not unlike humans have with indentation and parens highliters. At this point it would be pretty hard to miss a paren.