Earlier quoted context omitted.
> A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list. > Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generatin…
Now that you mention it, Claude has had trouble at times with balancing brackets in the elisp I have it write. Yet I still had the idea that LLMs should be better at lisp than other languages. A fascinating contradiction, thanks for pointing this out.
An agent in 100 lines of Lisp
71–80 of 84 posts
Re: An agent in 100 lines of Lisp
#72Earlier quoted context omitted.
> A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list. > Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generatin…
Now that you mention it, Claude has had trouble at times with balancing brackets in the elisp I have it write. Yet I still had the idea that LLMs should be better at lisp than other languages. A fascinating contradiction, thanks for pointing this out.
Neural Networks and the Chomsky Hierarchy
Re: An agent in 100 lines of Lisp
#73But it's also extremely brittle and unstable. It's really the opposite of what people look in agents.
Re: An agent in 100 lines of Lisp
#74Maybe this is a reductive comment, but how does this differ from just letting your agent bash tool a `python -c` command (or anything of that class)? I'm not really getting where this is a "wow" moment? It is always nice to appreciate how much power you get out of (Model + the absolute bare minimum of control flow). There is just so much baked into the models now that given an inch they will take a mile.
If you give your agent a `bash` or `python -c` tool, it starts a separate process that produces some output and then exits. After that, only the output and the exit code are available. In contrast, `eval` runs the code in the same execution context as the agent loop. When `eval` finishes, that execution context still exists. For example, any functions defined during an `eval` call remain available for later use.
I wonder if there are any efficiencies to be gained from running a stateful sidecar process like that or if the LLM will have too much of a hard time juggling the state to make coherent followup calls.
Re: An agent in 100 lines of Lisp
#75Earlier quoted context omitted.
Clearly, you’re not going to do it for just Fibonacci. And yes, you can always rewrite the agent code, quit, and restart to modify the agent. This is just like using an LLM to modify Pi and then restarting, which is done today. But being able to rewrite code in a live, running system is useful for all the reasons that Lispers have done it that way for 50+ years. In some cases, you can’t just serialize your state and…
> Sometimes, for instance, you might not even have access to the whole state because some of it resides on a remote server. Not sure what you mean. The system I outlined is one where some "state" resides outside the process in a separate server. You don't need to serialize that, you just need to serialize the information to need to reconnect. And my first point is even more relevant the more complex/distributed/britt…
Re: An agent in 100 lines of Lisp
#76Re: An agent in 100 lines of Lisp
#77Earlier quoted context omitted.
A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list. Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generating co…
> A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list. > Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generatin…
Isn't it more like when you write JSON in JavaScript you write it as a String? JavaScript has the data-type "String" but does it also have a built-in data-type "JSON"?
You can pass such a string containing JSON to (built-in) library function JSON.parse() and you can take a data-structure written in JavaScript can call JSON.stringify() on it. But if your JSON is malformed, does the JS-interpreter tell you that, before you call the library-function JUSON.parse() ?
If you have a JavaScript parser/interpreter, does it parse JSON too? If not I would say JSON is not part of the JavaScript language, even if JS runtime provides a library function for parsing it.
Re: An agent in 100 lines of Lisp
#78Earlier quoted context omitted.
A Lisp program that writes a Lisp program really just needs to produce a list of (nested lists) of tokens. A JavaScript program that writes a javascript program needs to generate a string that is syntactically valid JavaScript code. That is a much bigger task than just constructing a (nested) list. Because Lisp syntax is so much simpler than that of JavaScript etc. it is much easier to avoid errors when generating co…
I haven’t seen an LLM generate syntactically invalid code in any language in … a year? So I don’t know if “more likely to be syntactically valid” is a good enough selling point. But maybe I’m interpreting you too narrowly?
Re: An agent in 100 lines of Lisp
#79Earlier quoted context omitted.
Now that you mention it, Claude has had trouble at times with balancing brackets in the elisp I have it write. Yet I still had the idea that LLMs should be better at lisp than other languages. A fascinating contradiction, thanks for pointing this out.
This deepmind paper showed big limitations on nested structures with transformers, LSTMs actually did better: Neural Networks and the Chomsky Hierarchy https://arxiv.org/abs/2207.02098
Re: An agent in 100 lines of Lisp
#80Littered with AI writing tells.