8 ms·
Lisp is a powerful language that allows one to mix multiple logical levels within a program (especially through it's homoiconicity). Shrdlu is perhaps the most
by joe_the_user 8y ago
Lisp is a powerful language that allows one to mix multiple logical levels within a program (especially through it's homoiconicity).
Shrdlu is perhaps the most classic illustration of Lisp's power[1], A classic program from 1968-70 that allowed natural language communication about a micro world. It was written in a version of Lisp even more free-form than today. When I looked at the source code a while back, it's parsing of natural language involved a wide-variety of on-the-fly fix-ups and such to take into account the multiple irregularities of human language.
The thing about Lisp's power is it allows the production of complex program quickly but doesn't particularly have a standard way of gluing these programs together. The other classic Lisp work, The Bipolar Lisp Programmer[2], describes how Lisp has multiple partial implementations of important libraries and programs simply because it allows a certain type of personality to by themselves produce something that's remarkably good but doesn't encourage any particular group effort.
Lisp is certainly evidence that "language matters" but not evidence that Lisp is where one should stop.
[1] https://en.wikipedia.org/wiki/SHRDLU https://en.wikipedia.org/wiki/SHRDLU
[2] http://marktarver.com/bipolar.html http://marktarver.com/bipolar.html
- kazinator 8y agoI first came across SHRDLU in Gödel, Escher, Bach. I thought it was fictional!
- trainingaccount 8y agoI think the vast majority of coders would struggle to write anything like SHRDLU.
- kazinator 8y agoThe problem is that you can't arrive at such a thing by ordinary exploratory coding without a strong conceptual framework guiding what you're doing.
- joe_the_user 8y agoIndeed, Winograd wrote a short but serious book explaining the linguistic and other theories behind shrdlu. However, I don't think even a complete understanding of the points of his book would be sufficient to understand shrdlu's code.
- whytaka 8y agoCould you tell me which of his publications you refer to here?
- pjc50 8y ago> I don't think even a complete understanding of the points of his book would be sufficient to understand shrdlu's code That sounds like a point against the use of Lisp. There's certainly quite a lot of handwritten case-specific parsing code: https://github.com/stuartpb/shrdlu/blob/master/gramar https://github.com/stuartpb/shrdlu/blob/master/gramar Perhaps the bit which looks most lispish is the dictionary: https://github.com/stuartpb/shrdlu/blob/master/dictio https://github.com/stuartpb/shrdlu/blob/master/dictio (It also looks like this was written on one of those ancient systems that didn't support lowercase and only allowed 6-character filenames)
- kbp 8y ago> (It also looks like this was written on one of those ancient systems that didn't support lowercase and only allowed 6-character filenames) A limitation that also led to 'Schemer' dropping the R.
- tunesmith 8y ago> Lisp is a powerful language that allows one to mix multiple logical levels within a program (especially through it's homoiconicity). Statement like these are what make me suspect Lisp code would be a maintenance nightmare. I am regularly refactoring code to separate multiple logical levels so we can more easily maintain our codebases. If this is a misunderstanding, can someone clarify?
- akvadrako 8y agoI agree, strong barriers between layers are important. Right now the best way to build them is by using different languages or runtimes - it’s hard to mix layers if they require explicit network or shell calls. If everything was in lisp the layers are naturally blurred.
- p4bl0 8y agoRacket is a Lisp that makes these layers somewhat explicit.
- reikonomusha 8y agoGood SW engineering practice helps. Code review, collaborative design, etc.
- varjag 8y agoThere are perhaps languages out there which are better than Lisp for maintenance in some respect, but it's none of the mainstream ones. Lisp code is not particularly harder or easier to maintain; most of that depends on the original author(s) as with any codebase.
- crdoconnor 8y agoIt's the reason Aaron Swartz gave for rewriting reddit in python: >The others knew Lisp (they wrote their whole site in it) and they knew Python (they rewrote their whole site in it) and yet they decided liked Python better for this project. The Python version had less code that ran faster and was far easier to read and maintain. http://www.aaronsw.com/weblog/rewritingreddit http://www.aaronsw.com/weblog/rewritingreddit I suspect the problem is that LISP is too powerful. Language power is inversely related to maintainability/readability, as per the greatly underrated rule of least power: https://en.wikipedia.org/wiki/Rule_of_least_power https://en.wikipedia.org/wiki/Rule_of_least_power
- tannhaeuser 8y agoLispers praise Lisp's homoiconicity but today's networked world calls for a strict separation of data and executable code as in NX bits (and yes I'm aware of the classic "Can programming be liberated from the von Neumann style?", and don't agree with it). I don't know. I've always seen Lambda calculus as a model for computation to reason about program execution, but not as an actual implementation technique.
- alxlaz 8y agoWell, it's not like that's a thoroughly unknown problem. eBPF (https://lwn.net/Articles/740157/ https://lwn.net/Articles/740157/), for example, which effectively relies on running user-supplied bytecode in kernelspace, attempts to solve this (and does it reasonably well) by imposing a couple of constraints on the code you supply. These constraints, in turn, allow the program to be statically-analyzed before running it. In my experience, 90% of the cases where homoiconicity is useful are cases where the code you execute is trivial enough that you can statically analyze it, for example. E.g. you use the data to generate trivial processing code that would be tedious to write by hand.
- endgame 8y agoI don't think that's the case. Template Haskell lets you generate Haskell code at compile time, including by doing arbitrary IO. This is technically unsafe but is usually okay because you're only reading local files and so forth. It's occasionally really useful for generating things like database mappings, lenses, etc.
- _ph_ 8y agoYou are mixing up concepts. The Lisp concept of "the program is data" has little to do with modifying the program at runtime. It might be used for that in uncommon cases, but it is not recommended. A Lisp program usually is compiled into a static executable with a strict separation of data and executable code. The mixing between program and data happens at build time in the compiler through the macro facilities. The first important thing is, that a Lisp compiler is not something which runs as an abstract process, but runs in a Lisp system and can execute arbitrary Lisp code. So Lisp macros can execute any Lisp functions - written by the user - to transform the input code, represented as data which can be easily processed, into the output code, which gets compiled. The whole point is, that with macro expansion you are not tied to some pattern language, but can run any user-written code to process the code for output. This gives Lisp great power and extensibility. But this happens at compile-time, not at run-time. A good example of the power of this is, that the Common Lisp Object System (CLOS) can be entirely implemented in Common Lisp. You take any Common Lisp implementation which doesn't have an object system and load the CLOS code and you have the object system available.
- auganov 8y agoMakes me think of Cyc which is still around ( https://www.cyc.com https://www.cyc.com ). Wonder if any HNers have experiences with it? I tried opencyc and was fascinated. It's a prology lisp married to a huge database of rules and knowledge. The open source version doesn't ship with the knowledge part so it's hard to evaluate if it's of any practical use. Was meaning to apply for a research license but didn't find time yet.
- fmjrey 8y ago> The thing about Lisp's power is it allows the production of complex program quickly but doesn't particularly have a standard way of gluing these programs together. I'd argue Clojure is setting some new standard here with its powerful literal notation for basic data structures (list, vector, set, and maps) and its practice of integrating/composing first on data. Most of the time that's enough to get some libraries work together. If not enough, integrating/composing on functions is the next stage. Only after having covered data and functions should you consider macros, which should be easier to write if you have done a good job at the data and function levels. If such powerful and ubiquitous data structures work so well for programs written in clojure(script), why would that not be true in the larger picture for integrating systems? JSON worked much better than XML because it actually represents simple data structures, not objects talking to each other. Redis, Avro, and similar tech are continuing that story while Kafka adds a fantastic transport and storage mechanism. Sounds like we're closer to having better foundations for integration in the small and in the large.
- pjmlp 8y agoThat is how we coded configuration files in Tcl back in late 90's, serialized data structures which we only needed to source on load.
- mark_l_watson 8y agoI have used Clojure on several customer projects and my own Cookingspace.com hobby project. I like Clojure except for the way recursion is handled. I have been using various Lisps since 1982 and Clojure’s support for recursion bugs me.