10 ms·
Lisp from Nothing, Second Edition
- tug2024 1y ago[dead]
- tromp 1y agoLooking at file church.scm from the provided zip file [1], I see the following functions used to construct lists: (define kons (lambda (x) (lambda (y) ((pair false) ((pair false) ((pair x) y)))))) (define kar (lambda (x) (first (second (second x))))) (define kdr (lambda (x) (second (second (second x))))) (define nil ((pair true) ((pair true) false))) (define null first) (define atom (lambda (x) (first (second x)))) That's 2 extra booleans per list element. While the one for recognizing atoms is probably necessary, the other one for recognizing nil is not: (define kons (lambda (x) (lambda (y) ((pair false) ((pair x) y))))) (define kar (lambda (x) (first (second x)))) (define kdr (lambda (x) (second (second x)))) (define nil ((pair true) false)) (define null (lambda (x) (((second x) (lambda (a) (lambda (d) (lambda (z) false)))) true))) (define atom (lambda (x) (first x))) The use of null+car+cdr can usually be avoided by using a matching construct instead like (((second list) (lambda (a) (lambda (d) (lambda (z) deal_with_car_a_and_cdr_d ) deal_with_nil) [1] https://t3x.org/lfn/church.zip https://t3x.org/lfn/church.zip
- deleted 1y ago[deleted]
- nils-m-holm 1y agoBut then (ATOM NIL) is neither TRUE nor FALSE.
- tromp 1y agoI forgot to add the atom boolean to the nil representation. I made some changes that hopefully fix that.
- nils-m-holm 1y agoIndeed, thanks!
- nils-m-holm 1y agotug2024 wrote: > Doesn’t lisp extend lambda calculus (abstraction . application)? As a consequence, lisp (abstraction . application . environment)! Another valid question downvoted into oblivion. The environment in (lexically scoped) LISP is an implementation detail. Lambda calculus does not need an environment, because variables are substituted on a sheet of paper. So lambda calculus equals lexically scoped LAMBDA in LISP. Sure, you could view LISP as LC plus some extra functions (that are not easily implemented in LC).
- tug2024 1y ago[dead]
- vkazanov 1y agoAs somebody who read a couple of the author's books, and also somebody who spent almost a decade studying compilers, I am genuinely curious about the author himself. These works are something I both understand and would never achieve myself. These are cultural artifacts, like deeply personal poetry, made purely for the process of it. Not practically useful, not state of the art, not research level, but... a personal journey? If the author is reading this... can you share your vision? Motivation?
- AlexeyBrin 1y agoI second this, would be great if someone did a long form video interview with the author.
- nils-m-holm 1y agoThank you so much for reading my books and describing my work in such beautiful words! You basically answered your own question! My motivation is just the creation of something I find beautiful. The vision, to pass knowledge to those who seek it in the simplest possible way, where "simple" does not necessarily mean in the tersest form, but in a form that invites being digested. I do not usually talk much about "myself". I tried, but with no-one asking, I find it difficult to say anything.
- throwawaySimon 1y ago“I have nothing to say and I am saying it” Cage. Thanks for An Introduction to Mental Development, I've throughly enjoyed it!
- nils-m-holm 1y agoSo have I! :) And thanks for the Cage quote. I enjoyed that, too!
- ronald_petty 1y agoI just ordered this book. Looking forward to learning! Thank you for your effort.
- fermigier 1y ago"... and the chicks for free "?
- nils-m-holm 1y agoHaha, yes! You are the first one to notice or, at least, to respond.
- aidenn0 1y agoI have listened to that song probably 100s of times and always heard "checks," so I just learned something new about that song. Thanks. Maybe less embarrassing than talking about Rock the Cashbar by The Clash (though that one was corrected the first time I saw the back of the album).
- fuckaj 1y ago[dead]
- foota 1y ago"What else are lists, but alternatives?" (credit to https://aphyr.com/posts/340-reversing-the-technical-interview https://aphyr.com/posts/340-reversing-the-technical-intervie..., I always get a kick out of that and the follow up https://aphyr.com/posts/341-hexing-the-technical-interview https://aphyr.com/posts/341-hexing-the-technical-interview).
- wooby 1y agoThe book looks awesome. However, I find some irony in the presence of a “no AI” badge on the back cover considering Lisp was AI research.
- AlexeyBrin 1y agoI read it as "no Gen AI" was used to write this book.
- hirvi74 1y ago"No AI was harmed in the making of this book."
- nils-m-holm 1y agoAnd no AI has harmed the planet in the making of this book.
- nils-m-holm 1y agoI am well aware of that :)
- hermitcrab 1y agoThe title "Lisp from nothing" doesn't seem to fit with: "INTENDED AUDIENCE This is not an introduction to LISP." on page 10.
- gentooflux 1y agoNothing as in "from scratch", as opposed to Nothing as in "Visual Basic's NULL".
- nils-m-holm 1y agoYes, the book is about the bootstrapping of LISP, both in a historical and practical context. Hence "from nothing".
- kazinator 1y agoWould you also think that "Energy from Nothing" must be an introductory physics text? :)
- dang 1y agoRelated: Lisp from Nothing - https://news.ycombinator.com/item?id=24809293 https://news.ycombinator.com/item?id=24809293 - Oct 2020 (29 comments) Lisp from Nothing - https://news.ycombinator.com/item?id=24798941 https://news.ycombinator.com/item?id=24798941 - Oct 2020 (5 comments)
- nils-m-holm 1y agoThanks for resubmitting the posting! I appreciate it! :)
- Fraterkes 1y agoHas anyone here read his “Practical Compiler Construction”? It’s on of the shorter compiler books Ive seen, seems like it might be a good way to learn a bit more about assembly
- shoobiedoo 1y agoI was very curious about this too. I've had my finger hovering over the "buy" button for months but there are next to no reviews on it. I'm wondering how it differs from other, similar works
- nils-m-holm 1y agoThere are always the sample chapters, and the code from the book is in the public domain. :) The book is basically a modern and more complete version of the "Small C Handbook" of the 1980's. I goes through all the stages of compilation, including simple optimizations, but keeps complexity to a minimum. So if you just want to learn about compiler writing and see what a complete C compiler look like under the hood, without investing too much into theory, then this is probably one of very few books that will deliver. Edit: and then Warren Toomey has written "A Compiler Writing Journey" based on PCC, which may shed a bit more light on the book: https://github.com/DoctorWkt/acwj https://github.com/DoctorWkt/acwj
- Fraterkes 1y agoThx, I’m going to buy it I think!
- mindcrime 1y agoLooks awesome. Just ordered a copy. I'm just now picking up Peter Seibel's Practical Common Lisp again and taking another stab at immersing myself in the world of Lisp. So this is perhaps fortuitous timing.
- uncircle 1y agoOften recommended is Paul Graham's "On Lisp", available for free on his website: https://www.paulgraham.com/onlisp.html https://www.paulgraham.com/onlisp.html
- C-x_C-f 1y agoI love Lisp (I'm an Emacs user and often write in Racket for personal projects) but the one thing I never understood about the Lisp community is the emphasis placed on metacircular evaluators. I sure find them beautiful and all, but why do they take center stage so often? Beside the aesthetics and instructional value, I don't get the appeal. Also I feel that a bunch of the heavy lifting behind metacircular evaluators is actually done by the Polish notation syntax as well as the actual implementation, and these concepts don't get nearly as much love. Any Lisper who can illuminate me?
- Quitschquat 1y agoLong time lisper. It just doesn’t feel right unless your language can compile your language. It’s like wearing someone else’s underwear.
- fuzztester 1y agoor interpret
- Y_Y 1y agoAgreed, I hate interpreting other people's underwear.
- bifftastic 1y agoUsername checks out
- fuzztester 1y agowhose? yours? or your parents? not me (the gp), definitely, fartastic! :)
- rootnod3 1y agoThe metacircular evaluator shows how code is data and data is code. And in a way it’s like Maxwell’s equations. A simple proof of computation that also somehow implements a very neat language.
- john-tells-all 1y agoPurchased the author's `Scheme 9 from Empty Space` book and loved it. Lots of very well-commented and explained code, on how to build a language up from the beginning. So much fun. https://t3x.org/s9book/index.html https://t3x.org/s9book/index.html
- rootnod3 1y agoDamn. I ordered the first edition a few weeks back and now the second edition is out :D
- nils-m-holm 1y agoAww, man. If you haven't yet purchased the 2nd ed, send me an email!
- rootnod3 1y agoDone
- user3939382 1y agoDid you guys hear Ladybird is gonna be ClojureScript by default /dream
- AnonC 1y agoUnder “The Intended Audience” (page 10 of the PDF sample on the site), it says that this is not an introduction to LISP and that it would be more enjoyable with some prerequisites. Where does one — who has no knowledge of these prerequisites or about LISP (except that the latter has been heard in programming circles as something esoteric, extremely powerful, etc.) — start, before reading this book?
- chrsw 1y agoThere's ANSI Common Lisp by Paul Graham. I've never read it and I'm not sure it's the best introduction but thumbing through it I don't see how you can get any more basic than that.
- AnonC 1y agoThanks for the recommendation. I appreciate it. I’ve heard about this book before, but never read it.
- m-a-t-t-i 1y agoIf you prefer hands-on learning, How to Design Programs is pretty good resource for the foundations, with lots of examples and exercises: https://htdp.org https://htdp.org But learning the basics of lisp is more like a side effect, the focus is on program design.
- AnonC 1y agoThanks a lot. I’ve heard about this too, but didn’t spend time to follow through on reading it.
- leoc 1y agoHtDP users would probably also be interested in looking into some of the old courses based on it. List courtesy of charlysl: https://news.ycombinator.com/item?id=18891945 https://news.ycombinator.com/item?id=18891945 .
- Jach 1y ago
- globular-toast 1y agoCan anyone compare this with Queinnec's Lisp in Small Pieces? I was waiting for an English version of the 2nd edition but I guess it's never happening and my French has unfortunately regressed since then.
- nils-m-holm 1y agoLISP in Small Pieces discusses very sophisticated techniques, while LISP From Nothing is more about the quirks and implementations of early LISP. Of course you can write a modern LISP based on the things covered in LFN, but if you are planning to write more than a toy, then Queinnec's book is the one to read.
- uncircle 1y agoThe entire website of the author is worth exploring: https://t3x.org/index.html https://t3x.org/index.html I love it so much, and seeing your bibliography makes me feel like a kid in a candy store. The confluence of Asian philosophy and computing is delightful. To put you in the correct headspace this Saturday morning: https://t3x.org/whoami.html https://t3x.org/whoami.html
- 2wrist 1y agoThat is a joy! Thank you.
- nils-m-holm 1y ago"A kid in a candy store", I love it! :) Enjoy your stay!
- WillAdams 1y agoWhere is the bibliography? (I searched for it, but couldn't find it, expecting to find a list of books which the author referenced in writing/researching)
- svat 1y ago“Bibliography” is a word used in practice with multiple meanings; the dictionary prepared by Oxford Dictionaries for Google (https://languages.oup.com/google-dictionary-en/ https://languages.oup.com/google-dictionary-en/) gives (https://www.google.com/search?q=define%3Abibliography https://www.google.com/search?q=define%3Abibliography) three meanings: > • a list of the books referred to in a scholarly work, typically printed as an appendix. > • a list of the books of a specific author or publisher, or on a specific subject. "a bibliography of his publications" > • the history or systematic description of books, their authorship, printing, publication, editions, etc. "he regarded bibliography as a science" In this context clearly the second meaning is meant (https://t3x.org/index.html#books https://t3x.org/index.html#books); this also corresponds to meaning 2 at Wiktionary (https://en.wiktionary.org/w/index.php?title=bibliography&oldid=86573863 https://en.wiktionary.org/w/index.php?title=bibliography&old...) or 2b at Merriam-Webster (https://www.merriam-webster.com/dictionary/bibliography https://www.merriam-webster.com/dictionary/bibliography). > a list of works written by an author or printed by a publishing house “compiled a complete bibliography of John Donne”
- Woodi 1y agoWhen it will stop ? The minimal languages... To be useful for something language need to have at least minimal standard library. Or just possibility to do syscalls to do something. What is more important then new syntax and sugar over basic instructions.
- madmulita 1y agoDo I need a standard library to learn how to implement a language? Our objectives might, and most probably will, be different.
- stellalo 1y agoI don’t think the book aims at being “useful” in the usual sense of the term. Neither the minimal language it builds does. (They are probably “useful” in the dissemination of what the real essence of computation can reduce to, in practical terms.) Not everything needs to be useful in fact: certain things can be just enjoyed in their essence, just looked at and appreciated. A bit like… art? I am implementing my own Scheme as well. Why? I don’t know, one needs to do things that serve no apparent purpose, sometimes.
- wkjagt 1y agoI clicked on this and immediately wanted to buy it. But then someone in the comments said to also look at your other books and well damn, now I want to read all of them and I can't choose which to start with.
- nils-m-holm 1y agoYou don't have to buy them all at once! :) And then, at least for the compiler books, there is: http://t3x.org/files/whichbook.pdf http://t3x.org/files/whichbook.pdf
- wkjagt 1y agoThat's super helpful! I downloaded the samples for S9fES and LfN, checking those out first. I love how generous you are with the number of pages in the free samples by the way.
- neonrider 1y agoA hacker and a mystic. We need more of those.
- nils-m-holm 1y agoSecond edition, with a new chapter on lambda calculus.
- gritzko 1y agoThanks. I recently had to reinvent LISP to script my CRDT database. That was not much work, because I already had the notation (I use RDX, a JSON superset with CRDT types). Still, I stumbled at the idiosyncratic LISP bracketing. Luckily, RDX allows for different tuple notations. So, I styled it to look less alien to a curly-braced developer. Like this https://github.com/gritzko/go-rdx/blob/main/test/13-getput.jdr https://github.com/gritzko/go-rdx/blob/main/test/13-getput.j... For example, print change-dir make-dir; is equivalent to (print (change-dir (make-dir) ) ) in the old money. I wonder if I am reinventing too much here. Did LISPers try to get rid of the brackets in the past?
- AlexeyBrin 1y agoIf you don't get an answer here, try to contact the author directly through his website, he is pretty responsive.
- drob518 1y agoThere have been many attempts to get rid of sexprs in favor of a “better” syntax. Even John McCarthy, the inventor (discoverer?) of Lisp had plans for an “M-expression” syntax to replace “S-expressions.” It never happened. The secret is that Lispers actually view sexprs as an advantage, not something to be worked around. Once you discover symbolic editing and code manipulation based on sexprs, you’ll never go back to weak line editing. That said, some Lisp dialects (e.g. Clojure and Racket) have embraced other symbols like square and curly brackets to keep the code more terse overall and optically break up longer runs of parentheses. Probably the best example of a “Lisp without parentheses” is Dylan. Originally, Dylan was developed as a more traditional Lisp with sexprs, but they came up with a non-sexr “surface syntax” before launching it to avoid scaring the public.
- xedrac 1y ago