Let Over Lambda (英語) ペーパーバック – 2008/5/7
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
Let Over Lambda is one of the most hardcore computer programming books out there. Starting with the fundamentals, it describes the most advanced features of the most advanced language: Common Lisp. Only the top percentile of programmers use lisp and if you can understand this book you are in the top percentile of lisp programmers. If you are looking for a dry coding manual that re-hashes common-sense techniques in whatever langue du jour, this book is not for you. This book is about pushing the boundaries of what we know about programming. While this book teaches useful skills that can help solve your programming problems today and now, it has also been designed to be entertaining and inspiring. If you have ever wondered what lisp or even programming itself is really about, this is the book you have been looking for.
There are plenty of "wow, that is cool" moments and useful constructs demonstrated, that will probably make it into the reader's toolkit. But of greater importance is the progression in how these are delivered. While not a broad tutorial in Common Lisp (although the reader-macro chapter could serve fairly well in that capacity), Let over Lambda contains an underlying tutorial on the incremental/iterative development of such macros/tools against desired requirements - building up to constructs via interim revisions and explanations.
A book involving Lisp has little choice but to stand on the shoulders of giants, and by necessity these are frequently referenced and cited. The most important of these is Graham's "On Lisp" (currently available for free download) - which, while attempting to cover the breadth of the language, is regarded as one of the more advanced texts on macros. Some topics introduced in On Lisp (such as the leveraging of unhygienic macros) are taken much further in Let over Lambda, and combined with other constructs (such as capture/closures) that would have to be described separately in more general purpose tutorial or language overview.
The writing style definitely includes an "attitude" that is partially inherent to the material being discussed and partially from the author's obvious passion (a passion that becomes REALLY obvious in the Forth chapter). Hoyte often highlights the blanket superiority of Common Lisp over all other languages; but to a reader who has put in the time to learn Lisp macrology in enough detail to understand this book, this isn't a particularly large stretch. Also, certain comfortable safety idioms are challenged as being more safeguards for beginners. On several occasions, the reader receives an explanation: "Here is the what and why of adhering to restriction X. Now here are the incredible things that become possible when you break it!" This is demonstrated via unhygienic macros, as well as the broader concept of "duality of syntax" - a definition that evolves throughout the book.
Early in the introduction Hoyte states that macros (in a language that can leverage them) are more than just boilerplate-reduction tools for known simple cases; but that their power represents a sort of "uncharted territory" of immense potential. Certain common (seemingly) ideological arguments (things like lisp-1 vs lisp-2), were laid out against a backdrop of examples and threaded into the theme of the entire book. While often going out on a limb, the author makes his case.
I was inspired by this book.
In the first couple of chapters, the author shows examples of assembler, C and Lisp, mostly in preparation for introducing lexical closures.
Closures, it turns out, are generated easily in Lisp by using the construction "let over lambda".
Regarding closures, I agree with the author that most of us have been left "with the inaccurate impression that closures are only good for toy examples like counter." But in fact, "closures are the building blocks of Lisp. Environments, the functions defined inside those environments, and macros like defun that make using them convenient, are all that are needed for modelling any problem." And in fact, the author's aim is "to stop beginning Lisp programmers . . . from . . . reaching for systems like CLOS." Yes, CLOS offers certain things, but ". . . do not use [CLOS] when a lambda will suffice."
If you're like me, you find all this very refreshing and stimulating.
From pages 31-37, the author deftly shows how objects are collections of procedures and associated state, and how the entire object infrastructure is easily derived from the lexical closure, otherwise known as "let over lambda," and combinations of "let over lambda over let over lambda." The ease and power with which this is demonstrated is breath-taking.
A couple of more quotes: "Object systems are a formalisation of a subset of let and lambda combinations, sometimes with gimmicks like inheritance bolted on (footnote 10: Having macros is immeasurably more important than having inheritance.)"
"Once assignable value cells and good old lambda expressions are available, object systems are, at best, occasionally useful abstractions and, at worst, special-case and redundant."
As I indicated, I have not finished the book, but the first couple of chapters have given me plenty to consider. I highly recommend this book.