PurelyFunctional.tv Newsletter 270: Lisp and the metacircular interpreter
From OO to Clojure Workshop!
Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.
I've been working on a new course, this one about Domain Specific Languages (DSL) in Clojure. Writing languages comes naturally in Lisp—it was originally defined in itself with a handful of built-in primitives. The leverage is amazing.
And that tradition continues. Lispers like to leverage interpreters—functions that define what the parts of data mean. It's not uncommon for me to solve a problem in a straightforward way in 1000 lines of code. But then I'll try a more circuitous approach: I'll write a DSL for the problem. And it takes 500 lines to write the interpreter. Then it only takes 10 more lines to solve the problem in the DSL. That's 1000 lines vs 510 lines.
There's some magic happening there. It's the magic that Alan Kay's team is tapping into at VPRI to write a complete computing system in a fraction of the lines of code our word processors need today. The bottom line is that very simple languages can give us huge leverage.
Please enjoy the issue.
PS Want to get this in your email? Subscribe!
Alan Kay said "Most people who graduate with CS degrees don't understand the significance of Lisp. Lisp is the most important idea in computer science." But how can a programming language be an idea? This article explores Lisp as an idea.
Alan Kay himself answering the question on Quora.
Will Byrd explains why he thinks the Lisp interpreter written in itself is the most beautiful program ever written.
John McCarthy's seminal paper introducing Lisp. They syntax is undeveloped, but the core is there.
John McCarthy's manual of Lisp. Deep in the book, on pages 70 and 71, we find a definition of the Lisp interpreter.
This classic book develops an interpreter for Scheme in Chapter
using the classic metacircular evaluator technique. The metacircular
evaluator is where
eval is defined in terms of
defined in terms of
I've been really enjoying this podcast from NPR. They go into deep questions about how our psychology affects us in the real world.
Unlocking Data-drive Systems YouTube
Paul deGrandis talks about how they developed a data-driven system (another name for an interpreter) that generates web apps. It gave them tremendous leverage.
Jeanine Adkisson presents a host of good advice on how to design languages.
My new video course about one of the coolest ideas in Computer Science and certainly one of the best features of Lisps: writing interpreters and compilers. It turns out that this is not so hard! But the leverage is enormous! A small amount of code can drastically increase the expressivity of your code.
I recorded a new lesson this week. In this one, we go through a rite of passage that all good Lisp programmers eventually go through: writing your own Lisp interpreter.