9 ms·
The thing is that trying to understand "the power of Lisp" via the toy interpreter from The Roots of Lisp[0] is like trying to understand "the beauty of the sea
by phoe-krk 5y ago
The thing is that trying to understand "the power of Lisp" via the toy interpreter from The Roots of Lisp[0] is like trying to understand "the beauty of the sea" after seeing a single five-minute YouTube video explaining it.
It will give you the basic idea, but it won't tell you about macros, reader macros, compiler macros, and having the whole language always available to build your abstractions on; it won't tell you about CLOS, including multiple dispatch, metaclasses, or method combinations; it won't tell you about the condition system and programming from inside the debugger; it won't tell you about live recompilation and live coding; it won't tell you about the JVM interoperability of Clojure, Kawa, or ABCL; it won't tell you about Racket's tower-of-languages approach to programming; I can keep on going for a while. And, since most Lisp dialects and implementations are nowadays compiled, either to native code or to bytecode, the just-interpreting approach doesn't even work very well.
Articles like this are fun, but they end up completely missing the point. This isn't "the power of Lisp"; it's just the very, very, very beginning. The rabbit hole goes much deeper.
[0] http://www.paulgraham.com/rootsoflisp.html http://www.paulgraham.com/rootsoflisp.html
- agumonkey 5y agohere's how to leverage the pretty printer to transpile lisp into pascal https://merl.com/publications/docs/TR93-17.pdf https://merl.com/publications/docs/TR93-17.pdf
- phoe-krk 5y agoTIL. This is cursed. Have an upvote.
- agumonkey 5y agoHey, I didn't even realize who I was answering to. Btw there's a part 1 online too https://merl.com/publications/docs/TR91-04.pdf https://merl.com/publications/docs/TR91-04.pdf
- phoe-krk 5y ago> Hey, I didn't even realize who I was answering to. The best kind of comments are the ones which respond to the what as opposed to the who. :D
- deleted 5y ago[deleted]
- gumby 5y agoThat’s hilarious to me because I remember someone at UT wrote a pascal compiler in Lisp so TeX would run on the lispm.
- p_l 5y agoSymbolics provided Pascal, Prolog, Fortran 77, C and I believe Ada (but I never seen that one) implementations that used ZetaLisp as intermediate language. The Pascal one was used to build TeX, indeed.
- rmbyrro 5y agoI've learned Clojure. Tried and failed to see this unique power of macros. Truly asking for help: can you help explain what can I do with macros that I cannot do with functions? Or, maybe, cannot do with high quality or low complexity using functions?
- deleted 5y ago[deleted]
- mwattsun 5y agoMy impression, and I hope I'm wrong, is that macros and meta programming were powerful ideas 30 years ago, but now most modern languages have generics, template meta programming [1] and reflection. I'm a curious amateur and probably out to lunch, but there you go. [1] Some other languages support similar, if not more powerful, compile-time facilities (such as Lisp macros), but those are outside the scope of this article. https://en.wikipedia.org/wiki/Template_metaprogramming https://en.wikipedia.org/wiki/Template_metaprogramming
- bcrosby95 5y agoThe existence of template metaprogramming is an argument for macros, not against them. It shows the lengths to which programmers will abuse and misuse a feature so that they can reach their goals.
- mwattsun 5y agoWhen I first started writing asm code, it was accepted to write self-modifying code (programmatically create new code, then jmp to it.) Then I discovered and was told it was a bad idea. So that's how I view Lisp macros - creating code on the fly and executing it. When I was studying this issue, I came across femtolisp, which is a standalone Lisp by the author of Julia, Jeff Bezanson. Julia has metaprogramming so I wanted to look at it. In this video [1] Professor Steve G. Johnson explains metaprogramming (around 10 min mark) and says "most of the time, don't do metaprogramming." He points out in the base Julia there are 36,798 methods, but only 138 macros and 14 generated functions (.04% of the code), so I have the impression it is still frowned upon. [1] https://www.youtube.com/watch?v=mSgXWpvQEHE https://www.youtube.com/watch?v=mSgXWpvQEHE
- joshtbradley 5y agoAuthor here, that's an apt analogy. Perhaps it helps to understand where I was coming from; I had never written a line of LISP and was struggling to fully grasp the power that Paul Graham had hinted at. So I started at the beginning, and although it was just the brim of the rabbit hole it certainly opened my eyes. And I hope it can help other beginners open their eyes as well. I plan to fall down the LISP rabbit hole one day, and continue this series in full detail.