Why Learn Lisp?

Written by on October 20, 2022 in LISP, Programming with 1 Comment

In the last article, I had shared my views on why programmers should learn Prolog, preferably as the first language. What language should one learn next? I strongly pitch for Lisp, to be precise, “Common Lisp”.

Lisp happens to be the second oldest (1958) programming language, only after Fortran (1957)! Initially there were several dialects of Lisp, but the Common Lisp standard was published in the year 1994. Now there are several Common Lisp implementations available.

So, why should you learn Lisp? Before going into specifics, let me share a few delightful quotes about Lisp:

Lisp has jokingly been called “the most intelligent way to misuse a computer.” I think that description is a great compliment because it transmits the full flavour of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts.
– Edsger Dijkstra [1]

Lisp is a programmable programming language. Not only can you program in Lisp … but you can program the language itself.”
– John Foderaro [2]

“There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.”
– Paul Graham [3]

“LISP is worth learning for … the profound enlightenment experience you will have when you finally get it. That experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.”
– Eric Raymond [4]

Let me now walk you through some key aspects of Lisp.

1) Easy to Get Started

It is quite easy to get started with Lisp. The language is built around “S-Expressions” and every expression has a value. Thus, the language is primarily a functional programming language and it doesn’t take much effort to get the basics right. Of course, it will take a while to master the intricacies of advanced features of the language such as Macros, Condition System and Common Lisp Object System (CLOS). Thanks to the “Read-Eval-Print” loop of the interactive Lisp interpreter, writing and testing the code is always a pleasure.

2) Homoiconic

The beauty of Lisp is that data is indistinguishable from code, in other words “code is data”. This is possible thanks to S-Expression being the “native” data structure of the language. Since both code and data are legitimate S-Expressions, code can be “inspected” as data and data “evaluated” as code!

3) Language of Artificial Intelligence

John McCarthy created Lisp in 1958 (influenced by Lambda Calculus of Alonzo Church) and since its initial days, it has been the primary language used in Artificial Intelligence research. Lisp has been successfully used in various areas including Natural Language Processing, Computer Vision, Planning, and Rule-based Engines (e.g. Medical Expert Systems). Even today, while languages such as Python are predominantly used in the Machine Learning and Deep Learning space, there are libraries and tools enabling Lisp to be used as well.

4) Multiparadigm

Lisp, at its core, is functional and object-oriented. It also supports procedural paradigm like other languages. Although it is not declarative in the sense of Prolog, because of its homoiconicity and “malleable” nature, it is easy to implement Prolog (with “Lispy” syntax) and then write code in this embedded Prolog. In fact, both Allegro Lisp and LispWorks Lisp support such a Prolog implementation. It is really fun to take advantage of these ideas when writing non-trivial Lisp code.

5) Higher-Order Programming

Functions are “first class” objects (just as data are) in Lisp. It is possible to pass functions as parameters to other functions and also return functions from other functions. This ability allows the programmer to write generic functions whose behaviour can be fine-tuned by passing suitable execution logic. Some examples are the popular Map and Reduce operations.

6) Magnificent Macros

If there is one thing that excites most Lisp programmers, it must be the macros. Macros elevate Lisp to a “programmable” programming language. “Read macros” allow code to be run at read time (allowing the syntax to be extended), while regular macros allow code to be generated and executed at run time. With such unparalleled flexibility and power, it is almost trivial to embed a complete Domain Specific Language (DSL) inside Lisp!

7) Powerful Condition System

The Condition System shares some common features with the Exception Handling model supported in modern programming languages, but it is far more elegant and powerful! The conventional approach involves two parts namely, “signaling” an error and “handling” it. No doubt, this definitely provides the much needed “separation of concerns” and keeps the code reasonably clean. What is unique about Lisp is that there is a “third” part in this scenario. It is called “restart” and gives the programmer an additional level of flexibility in recovering from the error. The details are beyond the scope of this article. I strongly recommend the book by Michał Herda [5] to interested readers.

What about availability of high quality implementations of Common Lisp? SBCL is a popular open source implementation available on many platforms. Allegro CL and Lispworks Lisp are two respected commercial implementations. As my readers might be aware, I have been using these two for many years and I am quite happy with them.

Is Lisp being used anywhere? The popular AutoCAD program uses AutoLisp, a custom dialect of Lisp. Another well-known application is Emacs Text Editor, which uses Emacs Lisp. Opusmodus is a powerful Music Composition system written entirely in Lisp. I have written several articles on it. A list of companies/applications that use LispWorks Lisp appears here. Likewise, companies that use Allegro CL are mentioned here. This is another interesting list.

I hope I have managed to pique your curiosity about Lisp. Needless to say, Lisp is my favourite language and I even managed to embed it in my Astrology software, giving users the ability to write scripts to perform advanced analysis of charts.

I can assure you that once you start, you will find programming in Lisp an exhilarating experience!

Have a great week and a wonderful weekend!


1) Eugene Charniak, Christopher K.Riesbeck, Drew V.McDermott, and James R.Meehan, “Artificial Intelligence Programming (2nd Edition)”, Lawrence Erlbaum Associates, 1987.
2) Communications of the ACM, September 1991.
3) Paul Graham, “What Made Lisp Different”
4) Eric Raymond, “How to Become a Hacker”
5) Michał “phoe” Herda, “The Common Lisp Condition System: Beyond Exception Handling with Control Flow Mechanisms”, Apress, 2020.

Tags: , , , ,


If you enjoyed this article, subscribe now to receive more just like it.

Subscribe via RSS Feed

1 Reader Comment

Trackback URL Comments RSS Feed

  1. Richard Eng says:

    1) Smalltalk is even easier than LISP. In fact, it’s great for children!
    3) Smalltalk has also been used extensively for AI.
    4) Smalltalk has also been used to implement Prolog. Smalltalk also supports the functional paradigm because…
    5) Smalltalk can also do higher-order programming.
    6) Amazingly, Smalltalk is nicely extensible without the use of macros. Smalltalk is essentially its own DSL (domain-specific language).
    I only mention all this to point out that LISP is not really all that unique.

Leave a Reply

Your email address will not be published. Required fields are marked *