Lisp programming is the second oldest programming language in continued use today – the only language in use older than Lisp is Fortran.
John McCarthy invented Lisp at the Massachusetts Institute of Technology in 1958. Since then, Lisp has changed significant, and a number of dialects have come into and fallen out of use across the decades. Today, Common Lisp and Scheme are the most popular Lisp dialects used by programmers.
The term “Lisp” is shorthand for List Processing. However, Lisp isn’t limited to processing lists and both at its inception, and today, Lisp has been used to build artificial intelligence systems. Although it is well-suited for AI, Lips is very versatile, and it’s used widely including in CAD software and web applications.
What Makes Lisp Different?
Lisp is markedly different from virtually every other coding language in use today, and even those familiar with a variety of languages will note that the code used in Lisp is very strange.
Graham designed Lisp to be a dynamic, functional, and imperative language.
One of the features that make it distinct from other languages is the prefix notation. Using prefix notation, programmers create programs that feature operators that can handle any number of operands whereas other languages handle only two. This is achieved by placing the operator first and following it with operands within a set of parentheses.
Thus, a prefix notation in Lisp looks like this:
(+ 2 3 4 5)
The parentheses are crucial and mandatory because they demarcate the beginning and end of the arguments to the function, which is known as an s-expression.
S-Expressions in Lisp
An s-expression in commuting is a notation for nested list data, which is tree structured. S-expressions were invented for Lisp, and their use in Lisp has popularized them. The definition of an s-expression has two parts:
- It expresses the form x y, wand x and y are s-expressions (they are in parentheses).
- An S-expression is an ordered pair or binary tree.
S-expressions in Lisp can be used to represent source code. In this case, the first element of the code is the function name or operator. Al the remaining elements of the code are arguments. This, again, is prefix notation.
For example, a programmer might write 8 == (4+4) in C. The same Boolean expression would be written differently in Lisp: ( = 8 ( + 4 4) )
Why Use Lisp?
Lisp is beloved by programmers because it allows you to accomplish significant functions without ambiguity and instead using clearly expressed code. Lisp programmers enjoy accomplishing more – and doing it faster – than they might with other languages.
The claim that Lisp is faster and more intentional than other languages is disputed; everyone thinks they use the best programming language for their needs.
However, Peter Seibel presents an anecdotal but helpful argument in his book. He described how his own father switched a failing project from Fortran to Lisp and was able to accomplish results in half the time with only the remnants of the budget of the original project.
Although Seibel notes that you don’t get the immediate gratification with Lisp that you find in Java, C, and C++, he says it offers something more: it’s fun to code with. The philosophy of Lisp, particularly Common Lisp, is based on the idea that if a program is fun for the writer, then it will be good for the users. It allows codes who wonder why a feature doesn’t exist to build the feature into the program on your own.
Essentially, the key to Lisp’s success is that it allows the programmer to draw a distinct line between what they envision for the program in their head and what the code allows. There’s no boilerplate code required to obscure or limit the programmer’s ideas.
The second benefit of this clear connection is that Lisp code is easier to maintain. There’s no need to wade through piles of repeated idioms to make a change in the code; the change can be made directly. When making those changes, huge swaths of code aren’t required to support even a small change. Changes are made fairly directly.
Programmers see the benefits of Lisp when working on big expensive projects, but the advantages also appear when simply tinkering around. Lisp requires less work to explore the viability of a project or function. Those who don’t have a clear intention to translate into code may find it easier to flesh out their ideas incrementally using Lisp.
Ultimately, Lisp allows programmers to write less code – and less useless code – and focus on core intentions. By cutting out the extra work, Lisp can accomplish more in less time – and with less money.
Common Lisp and AI: A Match Made in Virtual Heaven
Common Lisp, a popular dialect of Lisp, was used in many artificial intelligence programs, and for a good reason.
Common Lisp works well with symbolic artificial intelligence, which is the type of AI research that works with human-readable representations of logic, problems, and search. It dominated the research scene between the 1950s and late 1980s.
Programmers used Common Lisp to build these early AI programs for several reasons. First, it has strong implementations. It’s also homoiconic, which means it deals with programs as though its data and allows for the easy development of meta-programming techniques.
The programming language also provides a good environment: it’s easy to debug it and work on it incrementally without affecting any of the surrounding code.
Finally, working with Common Lisp is fast: the dialect doesn’t require the low-level detail found in other languages, which means you don’t spend hours writing ancillary code.
Some of the symbolic AI programs developed in Common Lisp include Eurisko, which was developed as a follow up program to Automated Mathematician, and Cyc, the world’s oldest artificial intelligence project.
Deep Learning and Neural Networks
Common Lisp may be popular among symbolic artificial intelligence programs, but it’s not used in most neural network or machine learning libraries because neither fall within the symbolic intelligence field.
The Legacy of the Lisp Language
Lisp was the dominant language of symbolic AI until the 1990s rolled around. It was so popular that it wound up being oversold to the whole of business and technology as the premier AI language, which resulted in a backlash. From the end of the 1980s, AI programmers chose to switch to C++.
Today, the languages used in AI are more diverse. Prototypes are often created with a young language offering the dynamic movement required for making endless changes – Python, Perl, Ruby, or a language or dialect of a similar ilk.
Once a program is ready to be shown the world, it’s typically finalized in C or C++, but Java is also occasionally used.
Just because Lisp no longer dominates the AI scene doesn’t mean it’s not still useful. What was true in the 1970s and 1980s remains true now: Lisp may no longer be the best prototyping tool, but it remains an excellent one. If you’re trying to tackle a problem and neither the problem nor solution are fully formed, then Lisp is an excellent tool for the starting stages.
Popular Projects Completed in Lisp
Edsger Wybe Dijkstra, a Turing Award winner for his contribution to programming, called Lisp the smartest way to misuse your computer, but it’s been used in some impressive projects over the years. Here’s just a small sample:
Mirai was built with Lisp. The software was used to create the Gollum character in The Lord of the Rings films.
The Dynamic Analysis and Replanning Tool (DART) runs with Common Lisp dialect. DART is used by the United States military to solve serious logistical problems, saving the Department of Defense millions of dollars and countless man hours in relieving bottlenecks and inadequacies in the support system. It also facilitated the movement of European bases to new bases in Saudi Arabia before Operation Desert Storm.
Viaweb, one of the pioneers in e-commerce, was built with Lisp. The company offered a web-based application to help users build their own online stories with nothing more than a web browser. Viaweb was old to Yahoo for $49 million in 1998.
Memetrics, a marketing analytics program, was developed using Lisp; Accenture bought Memetrics in 2008.
Peter Christensen provides a list last updated in 2008 of Lisp companies developed in the last few decades.
Lisp Is Still Relevant
Lisp and its dialects may no longer be the darling of AI and machine learning, but these languages provided major contributions to the development of technology in the last sixty years. More importantly, Lisp is still a useful tool for building programs, particularly if the program is still opaque.
What programming languages do you consider to be the most important in the development of AI? Would you go through a Lisp tutorial even today? Share your stories in the comments below.