Preface
This book has been a continual work in progress since 2011. This current edition is released on Julie 29, 2025. I have used Common Lisp professionally since 1982 and I love the language!
I hope you have fun with this book and that you find the content useful for your own projects.
How To Read This Book?
I have been using Common Lisp professionally since 1982 and also use Common Lisp for my own experiments. This book contains many little ideas and many little bits of code. If you already know Common Lisp then I recommend looking at the table of contents and simply starting with the topics that interest you the most.
Requests from the Author
This book will always be available to read free online at https://leanpub.com/lovinglisp/read.
That said, I appreciate it when readers purchase my books because the income enables me to spend more time writing.
Hire the Author as a Consultant
I am available for short consulting projects. Please see https://markwatson.com.
Why Use Common Lisp?
Why Common Lisp? Isn’t Common Lisp an old language? Do many people still use Common Lisp?
I believe that using Lisp languages like Common Lisp, Clojure, Racket, and Scheme are all secret weapons useful in agile software development. An interactive development process and live production updates feel like a breath of fresh air if you have development on heavy weight like Java Enterprise Edition (JEE).
Yes, Common Lisp is an old language but with age comes stability and extremely good compiler technology. There is also a little inconsistency between different Common Lisp systems in such things as handling threads but with a little up front knowledge you can choose which Common Lisp systems will support your requirements.
Acknowledgments
I would like to thank Jans Aasman for contributing as technical editor for the fourth edition of this book. Jans is CEO of Franz.com which sells Allegro Common Lisp as well as tools for semantic web and linked data applications.
I would like to thank the following people who made suggestions for improving previous editions of this book:
Sam Steingold, Andrew Philpot, Kenny Tilton, Mathew Villeneuve, Eli Draluk, Erik Winkels, Adam Shimali, and Paolo Amoroso.
I would like to also thank several people who pointed out typo errors in this book and for specific suggestions: Martin Lightheart, Tong-Kiat Tan, Rainer Joswig, Gerold Rupprecht, HN member rurban, David Cortesi. I would like to thank the following Reddit /r/lisp readers who pointed out mistakes in the fifth edition of this book: arnulfslayer, rpiirp, and itmuckel. I would like to thank Ted Briscoe for pointing out a problem with the spacy web client example in the 6th edition.
I would like to thank Paul Graham for coining the phrase “The Secret Weapon” (in his excellent paper “Beating the Averages”) in discussing the advantages of Lisp and giving me permission to reuse his phrase.
I would especially like to thank my wife Carol Watson for her fine work in editing this book.
Setting Up Your Common Lisp Development System and Quicklisp
First, clone the GitHub repository that contains both the example programs and the manuscript files for this book: https://github.com/mark-watson/loving-common-lisp.
These instructions assume the use of SBCL. I assume that you have installed SBCL and Quicklisp by following the instructions at lisp-lang.org/learn/getting-started. These instructions also guide you through installing the Slime extensions for Emacs. I use both Emacs + Slime and VSCode with Common Lisp plugins for editing Common Lisp. If you like VSCode then I recommend Yasuhiro Matsumoto’s Lisp plugin for syntax highlighting. For both Emacs and VSCode I usually run a separate REPL in a terminal window and don’t run an editor-integrated REPL. I think that I am in the minority in using a separate REPL running in a shell.
Let’s start with configuring SBCL and Quicklisp:
Edit your file ~/.sbclrc to add the following line of code:
1 (pushnew #p"/Users/mark/GITHUB/loving-common-lisp/src"
2 ql:*local-project-directories*
3 :test #'equal)
NOTE: Please change the path #p“/Users/mark/GITHUB/loving-common-lisp/“ to the path where you cloned this repository using:
1 git clone https://github.com/mark-watson/loving-common-lisp.git
You have now configured SBCL to work with my book examples. For other Common Lisp implementations, please edit the relevant configuration files:
1 Common Lisp implementation startup files include:
2
3 SBCL: ~/.sbclrc
4
5 CCL: ~/.ccl-init.lisp
6
7 ECL: ~/.eclrc
8
9 CLISP: ~/.clinit.cl
10
11 Allegro CL: ~/.clinit.cl or ~/clinit.cl
I have used the SBCL implementation of Common Lisp in this book. There are many fine Common Lisp implementations from Franz, LispWorks, Clozure Common Lisp, etc.
If you have any great difficulty adopting the examples to your choice of Common Lisp implementations and performing web search does not suggest a solution then you can reach me through my web site, markwatson.com.