Hacker News

Lisp from Nothing(t3x.org)

175 pointsnils-m-holm posted 2 days ago29 Comments
wwweston said 2 days ago:

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

RodgerTheGreat said 2 days ago:

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

[0] http://galileo.phys.virginia.edu/classes/551.jvn.fall01/ftra...

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

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

FullyFunctional said 2 days ago:

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 https://github.com/uho/preForth) but it's sure not the only way.

stevekemp said a day 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.

FullyFunctional said a day ago:

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 said 2 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 said 2 days ago:

It's my little side project at the moment.

nextaccountic said 21 hours ago:

I'm interested in a link too :)

wwweston said 2 days ago:

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

RodgerTheGreat said 2 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:


pabs3 said 2 days ago:

This reminds me of https://bootstrappable.org/, IIRC there is Lisp in some part of their Linux bootstrap process.

gnufx said a day ago:

Presumably GNU MES, used for Guix: https://www.gnu.org/software/mes/

seg_lol said 2 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 said 2 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 said a day 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: https://www.xorpd.net/pages/x86_adventures.html

xelxebar said 2 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!

globular-toast said a day 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 said 2 days ago:

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

galaxyLogic said 2 days ago:

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

Syzygies said 2 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 said 2 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 said 2 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 said 2 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 said a day 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 said 2 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 said a day ago:

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

pfdietz said a day 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 said a day 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 said a day 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