PurelyFunctional.tv Newsletter 270: Lisp and the metacircular interpreter

Sign up for weekly Clojure tips, software design, and a Clojure coding challenge.

Issue 270 - March 26, 2018 · Archives · Subscribe

Hi Clojurers,

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.

Rock on!
Eric Normand <eric@purelyfunctional.tv>

PS Want to get this in your email? Subscribe!

The Idea of Lisp

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.

What did Alan Kay mean by, "Lisp is the greatest single programming language ever designed"?

Alan Kay himself answering the question on Quora.

The Most Beautiful Program Ever Written YouTube

Will Byrd explains why he thinks the Lisp interpreter written in itself is the most beautiful program ever written.

Recursive Functions of Symbolic Expressions Their Computation by Machine, Part I PDF

John McCarthy's seminal paper introducing Lisp. They syntax is undeveloped, but the core is there.

LISP 1.5 Programmer's Manual PDF

John McCarthy's manual of Lisp. Deep in the book, on pages 70 and 71, we find a definition of the Lisp interpreter.

Structure and Interpretation of Computer Programs Book

This classic book develops an interpreter for Scheme in Chapter 4, using the classic metacircular evaluator technique. The metacircular evaluator is where eval is defined in terms of apply and apply is defined in terms of eval.

Hidden Brain

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.

Design and Prototype a Language In Clojure YouTube

Jeanine Adkisson presents a host of good advice on how to design languages.

Domain Specific Languages in Clojure

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.