3 ms·
Is there something inherent to Lisp that allows it to be implemented in so little code? I believe I saw someone demonstrate that almost nothing in a Lisp imple
by mrweasel 1y ago
Is there something inherent to Lisp that allows it to be implemented in so little code?
I believe I saw someone demonstrate that almost nothing in a Lisp implementation was written as a "built-in" language feature that required the underlying interpreter to provide the functionality.
- krig 1y agoFirst off, you wouldn’t write an actual interpreter for lisp like this if you wanted to use it for anything serious, it’s very slow. The parser is very simple thanks to the s-expressions, and the only builtin special forms really needed are quote, cond and lambda, that’s pretty much it. The only data structure is a list, so functions are just lists, function calls are lists etc.
- rollcat 1y agoLisp (and similarly, Forth) is closer to a mathematical construct than an actual language. We've had to wrap it in parentheses and named symbols to help make sense of it, to talk about it. Pairs, atoms, GCs, are all an implementation detail.
- giancarlostoro 1y agoI always think of this HN post every few years, as an aside, someone really needs to archive that page it links to because I wont be surprised when that site shuts down or deletes old content: https://news.ycombinator.com/item?id=9699065 https://news.ycombinator.com/item?id=9699065 https://speakerdeck.com/nineties/creating-a-language-using-only-assembly-language https://speakerdeck.com/nineties/creating-a-language-using-o...
- krig 1y agoThis is super cool! I could imagine writing a very basic forth or lisp compiler in assembler, but even that would be quite the project.
- baq 1y agosee previous discussions at https://news.ycombinator.com/item?id=14727881 https://news.ycombinator.com/item?id=14727881 quoting the submission verbatim: The original paper of LISP by John McCarthy http://www-formal.stanford.edu/jmc/recursive.html http://www-formal.stanford.edu/jmc/recursive.html Or the more accessible explanation by Paul Graham http://www.paulgraham.com/rootsoflisp.html http://www.paulgraham.com/rootsoflisp.html
- kazinator 1y agoYes there's something inherent. Namely this: the ability to drop all sorts of requirements off the table, yet still call it some kind of Lisp. It does not need to be compiled to be a Lisp. It doesn't need arbitrary precision integers. It doesn't need hash tables. Garbage collection doesn't have to work; it can just run out of space and terminate. It can just crash on errors without a trace. It doesn't need to report the line number where a syntax error likely began. You get the picture.
- krig 1y agoI’ll remove even more and _still_ call it a lisp and there is nothing you can do to stop me. Any memory management solution will run out of space and terminate unless there is literally infinite memory available. But I guess hash tables is what people think about when thinking about what makes something a lisp or not.
- kazinator 1y agoWhereas in contrast, you cannot have a race this kind of race for the bottom with most other languages; tripping over the other contestants to see who can remove the most features, yet still have Python or Java. See? There you go, mrweasel; I think we hit the nail on the head.