I finished Let Over Lambda recently. I'm not an experienced lisp programmer but it's strangely readable if you allow yourself to not understand every little detail of the Common Lisp code. For example I hadn't read On Lisp. I had read The Little Schemer.
It's a wonderful tour of advanced macro concepts. With several of the macros presented I found myself saying "well that's just x language feature in y" but that's missing the point. The point is that Common Lisp allows you to implement your own language features, with macros of course!
This chapter is a wonderful climax to the whole book. Lisp moving Forth moving Lisp reminded me of the intertwined nature of DNA, RNA and proteins in Biology.
There's great humour throughout the book, I especially enjoyed the little sideways jabs at Scheme programmers!
As I like to say, Forth is the dual of Lisp. They reach the same goal (a programmable programming language) through completely different and complementary methods.
Similar here, though I didn't quite get as far. I started wondering about performance of all the things, when one has only 2 stacks to work with, and then discovered some library that implemented arrays somehow. I tried using GForth in Advent of Code and needed to read in lines from a file. Lines of different lengths and so on and that's where I failed. I think I would have had to learn a lot about how to use and manage the "pad" or some other surprising technique, that I didn't see anywhere. Since I couldn't manage to read in the lines and discard the old contents of a line, if the next line was shorter, remnants of the previous line persisted and I got wrong line readings. That's where I stopped.
I am sure someone more knowledgeable would have been able to breathe right past that issue somehow.
But I remember one moment that actually humbled me a little: There was a puzzle, where the input were some kind of "instructions" of how to move or for some device. Of course I built some logic that interprets those instructions and only then does something.... but then I saw on reddit, that people simply defined the words that literally are the instructions and took the input as Forth code, duh!!! So simple! Made me feel a little silly.
I'm not fluent enough in Common Lisp for that book, but the patterns in Let over Lambda translate cleanly to Julia. You can have "Let over Lambda", "Let over Lambda over Let over Lambda", "Anaphoric Macros" (though you have to break hygiene with esc(), and in practice should just use the native julia do block), "Reader Macros" (via String Macros), "Pandoric Macros", and so on.
7 comments
[ 0.28 ms ] story [ 14.2 ms ] threadIt's a wonderful tour of advanced macro concepts. With several of the macros presented I found myself saying "well that's just x language feature in y" but that's missing the point. The point is that Common Lisp allows you to implement your own language features, with macros of course!
This chapter is a wonderful climax to the whole book. Lisp moving Forth moving Lisp reminded me of the intertwined nature of DNA, RNA and proteins in Biology.
There's great humour throughout the book, I especially enjoyed the little sideways jabs at Scheme programmers!
It was a mind bending experience, although I quit after a while as the programs were kind of glass sheet quality brittle as they grew.
Sometimes I feel I need to start again to keep my brain from losing thinking skills over time.
I am sure someone more knowledgeable would have been able to breathe right past that issue somehow.
But I remember one moment that actually humbled me a little: There was a puzzle, where the input were some kind of "instructions" of how to move or for some device. Of course I built some logic that interprets those instructions and only then does something.... but then I saw on reddit, that people simply defined the words that literally are the instructions and took the input as Forth code, duh!!! So simple! Made me feel a little silly.