Lisp from Nothing


180 points | by nils-m-holm 8 days ago


  • seg_lol 8 days ago

    Nils, have you thought of doing a master class?

    I have utterly, most thoroughly enjoyed everything you have produced. Imperative, functional, low-level, high-level it is all excellent.

    If having a class isn't your thing, would you consider taking requests for books?

    • nils-m-holm 7 days ago

      > Nils, have you thought of doing a master class?

      I guess you mean online? I have thought about real-life, but interest in the topics I care about is ... not so wide-spread.

      Online? I have heard about such things but have no idea what it would look like. I guess there would be a lot of technology involved, and I do not get along well with tech. :)

      > I have utterly, most thoroughly enjoyed everything you have produced. Imperative, functional, low-level, high-level it is all excellent.

      Thank you! This is good to hear!

      > would you consider taking requests for books?

      I am afraid not. You may make suggestions, though, and if they coincide with my plans, they might tip the scales.

      • josrod 7 days ago

        You could record some video lectures and write exercises/instructions for them and put up a link to Gumroad (or any other similar service) on your website.

        An example:

        • xelxebar 7 days ago

          I am in the happy position of having just stumbled upon your site for the first time. Your interests lie very close to my own. Extremely happy to know you exist. Keep blazing your trail!

      • RodgerTheGreat 8 days ago

        I recently implemented a similar (though more constrained) interpreter in assembly language, for the CHIP-8 virtual machine. Might be of some interest:

        • wwweston 8 days ago

          Has anyone ever bootstrapped first to a Forth and then to a Lisp?

          • RodgerTheGreat 8 days ago

            Most people skip straight from the Forth to Fortran[0][1] or Prolog[2].


            [1] "Scientific Forth" (Julian V. Noble, 1992)

            [2] "Designing and Programming Personal Expert Systems" (Carl Townsend & Dennis Feucht, TAB Books, 1986)

            • Must. Resist. Rat-hole.

              I have mused about a related question since I got my first computer eons ago. It had only a machine code monitor (yes, a though start to learning what a computer was). It does seem some kind of Forth might have been the good first step on the path to high-level languages (like but it's sure not the only way.

              • stevekemp 7 days ago

                I've had a lot of fun writing a simple FORTH-like recently:


                Inspired by a previous hackernews comment-thread, I don't use a return-stack. So while I do have support for `if` it is implemented in a hardwired fashion.

                I'd love to spend the time to do it properly, but I suspect rabbit-hole wouldn't even begin to describe the amount of time I'd sink into it.

                • I did sink into it for a bit, playing with a matrix of 9 different schemes. However instead of Forth I’d implement Leroy’s ZINC model and implement a simple RPN version of the lambda calculus.

              • lukego 7 days ago

                I've ported Squeak Smalltalk to run on a Forth firmware substrate (OLPC XO.) That's not bootstrapping but it is a satisfyingly compact high-level OS.

                • mmphosis 7 days ago

                  It's my little side project at the moment.

                  • wwweston 7 days ago

                    If you've got a link, would love to read more!

                    • nextaccountic 7 days ago

                      I'm interested in a link too :)

                  • pabs3 8 days ago

                    This reminds me of, IIRC there is Lisp in some part of their Linux bootstrap process.

                  • globular-toast 7 days ago

                    It's been a while since I read a good book about Lisp. The last one was Let Over Lambda which I thoroughly enjoyed. I'll be ordering this one for sure.

                    • dfischer 8 days ago

                      This is exactly the content I’m looking for. Thank you.

                      • galaxyLogic 8 days ago

                        Interesting. I looked at the code-samples. Why are there so many all-uppercase symbols?

                        • Syzygies 8 days ago

                          This book takes an historical perspective. When I bought my first computer in 1980, an Apple II, lower case required a hardware mod. Lisp had already been around for decades.

                          In every major system one can now hide upper case conventions, but they too often default to old man shouting "GET OFF MY LAWN". And of course, those parentheses. One can easily represent trees by a notation that does away with most parentheses, but instead they've become a loyalty test.

                          At $20 or even $30 I would have bought the PDF for this book, to keep my library complete, to support all Lisp efforts. $40 made me think. This is a pure optimization problem; one should roughly want to maximize revenue, but favoring number of copies sold for the side benefits. I doubt that $40 achieves that maximum.

                          • nils-m-holm 7 days ago

                            > This book takes an historical perspective.

                            I enjoyed the return to typing in upper case very much! Ancient LISP in particular is nice to type, because there are only letters and the occasional dash, asterisk and parenthesis. All the special characters in modern languages really hurt my fingers!

                            >One can easily represent trees by a notation that does away with most parentheses, but instead they've become a loyalty test.

                            But can you copy or delete an expression from that other representation by paren-matching in your editor? To me (and others I guess) this was not much of an initiation ritual. I fell in love with parentheses on first sight.

                            > $40 made me think.

                            I get that! And to be honest, writing becomes more painful as I grow older, so I adjusted the price a bit to compensate for that. So far the sales numbers suggest that people are willing to spend the money.

                            BTW, the PDF and paperback generate the same royalties (as with all of my books). The price difference is the production cost of the physical book. So you pay the same for the content in either case.

                            • taeric 8 days ago

                              If it helps, I opted for the paperback. Looking forward to giving this one a read.

                              The caps point is interesting to me. I can't think of a good reason why caps should be shouting, but I definitely agree with it. Hilarious to remember back when mixed case was not the norm. (Also, awkward to work in languages where symbols are case sensitive. Worse when they are case significant.)

                              I'm curious on the tree representations you mean. Most make some use of whitespace, that I have seen. But they lose the portability of the representation that I have with easy copy/paste to other environments. (To and from chats, emails, etc.)

                              • nils-m-holm 7 days ago

                                > I'm curious on the tree representations you mean.

                                I guess OP meant symbolic expressions (LISP expressions) in general, which can be viewed as trees. E.g.:

                                    (FOO BAR . BAZ)
                                would be

                                      / \
                                    FOO  O
                                        / \
                                      BAR BAZ
                                • taeric 7 days ago

                                  Right, I get that. My question is what other forms did they mean? One could use indentation. Basically yaml. That is notoriously bad for copy paste between files, though.

                                  Edit: I see you made the same point in another post. I'm calling that portability of the code, though not sure that is the best term.

                                • Hyolobrika 7 days ago

                                  What is "case significant" vs "case sensitive"? You seem to be speaking as though there is a difference but I can't find anything online.

                                  • taeric 7 days ago

                                    In go, starting a function with a capital letter means something.

                              • pfdietz 7 days ago

                                Originally Lisp was all upper case. The line of languages is six decades old, after all. The first Lisp program I ever wrote was on punch cards on an IBM 7094.

                                The evolution of to Common Lisp had to deal with this. The solution (which works well) is that the default mode of the Lisp reader converts symbol names to upper case, unless they are escaped. So, the common case is that symbols are lower case in source files, but are upper case internally, and typically are printed in upper case (that can be tweaked if desired.)

                                • galaxyLogic 7 days ago

                                  So we have Lisp where case does not (mostly) matter and Python where even whitespace matters. We have APL famil;y of languages which invented their own alphabet. In hindsight I wonder if there is any consensus or studies on which approach is the best?

                                  • rurban 7 days ago

                                    In hindsight we know now what was problematic about the lisp reader conventions. The default should have been lowercase case-sensitive, esp. for the ffi.

                                    But we've only got uppercase case-insensitive, with flags for inverse (an ugly hack) and case-sensitive. This way you can call C or Java functions, but internally it's all case inversed. And still broken in some lisps