I have wanted to learn Lisp for a long time. Everything I heard about it made it sound like the kind of language I would use for myself. Alan Kay says it is “..the greatest single programming language ever designed”, and he is not alone thinking that there is something special about it.

Why Common Lisp?

Part of the magic of Lisp is how extensible it is. It allows you to write code that writes code for you. As a result, there are many Lisp dialects out there, Common Lisp being one of them.

Since Common Lisp is not widely used today, friends asked me why I chose that and not, say, Clojure, a dialect of Lisp that is rapidly gaining popularity. But my goal was never to learn the dialect that I will most likely use in production.

My goal is to understand the underlying concepts that make Lisp different; and from the outside it seems like the best books for that purpose were written 20 years ago, using Common Lisp. More on that later.

Getting Started

The Common Lisp ecosystem is scary to an outsider. The recommended editor is Emacs and unless you are already familiar with it, it is daunting to learn both an alien language and how to use a complex editor at the same time.

Here is how you can start in 5 minutes with your own code editor:

Note: The following section is for mac users. I am hoping to add a linux/Windows section in the future.

The easiest way to setup your environment is to use roswell.

brew install roswell

roswell is a “full-stack environment for Common Lisp development”. But for now, all we need is the REPL (Read-Evaluate-Print-Loop).

As the name suggests, the REPL is a dynamic environment to run Lisp code, and later on load it from a file.

To launch a REPL:

ros run

At this point you can start using the REPL to evaluate your Lisp code:

> 3

3

> (+ 2 3)

5

To load a file into the REPL use load:

> (load "somefile.lisp")

Where to Learn?

Here is what worked for me:

Practical Common Lisp is great for getting you started, especially chapter 3.

To get a better theoretical grasp of the basics I recommend ANSI Common Lisp by Paul Graham.

I am not there yet but my next steps and the de facto reason I chose Common Lisp are:

Using Your Own Editor

Here is what’s really important:

Parenthesis matching. Having your REPL connected to your code editor to quickly test your code. It’s not always obvious where to put parenthesis, even for simple operations like variable assignments and iterations. Learn it once and create a code snippet. Shout-out to Snippet-Generator for making it really easy.

VSCode as a case study

Here is a how to get a viable IDE with VSCode. I am not claiming it is as good as using Emacs with slime, just that it is good enough to get you started.

Download the lisp-syntax extension.

Use a parenthesis matching extension. I am currently using Rainbow Brackets.

Launch a terminal inside VSCode and then launch a REPL. use the “Run Selected Text in Active Terminal” from the Command Palette (⇧⌘P) to quickly test your code.

Create your own snippets. Here is a file with some of mine.

Any suggestions on how to improve this short guide are welcome.

Happy Lisp coding!