Lisp is Beyond Good and Evil

Those who need a well-written introduction to Lisp, should refer to Paul Graham’s website. Here, you will only find a couple of flashy highlights about the language itself, as this article is meant to entertain and not to teach (both of which I can’t do). If you have any doubts regarding the credibility of the reading that follows, even if your doubt is microscopic, just be sure: I have zero experience in Lisp.

Functional and Imperative Programming Languages

Although not purely, Lisp is a functional programming language — and functional languages, strangely enough, are based on mathematical functions. Unlike imperative languages (such as everything) that highly rely on von Neumann Architecture, Lisp tries not to restrict itself to anything. 1

Imperative programming languages (abbreviated as IL from now on) have state (variables, memory cells) that change over time, and this makes it difficult for a human to guess the outcome of a program.

Functional programming languages (FL) have no state, hence, iteration becomes obsolete. Instead of loops, FL rely on recursion. Unlike IL, here, if given the same parameters, executed functions always return the same outcome. That eases testing and readability. 2

The syntax and semantics of FL are simpler than of IL’s, and even though functional programs tend to be relatively slower than their imperative counterparts, they are still considered to be efficient enough.

Why Lisp is Awful

As you probably are here out of Lisp-curiosity or via Skype link, I am not going to bring arguments for you to learn Lisp. But I can suggest you a trick if you want to understand whether a programming language is worth studying or not.

Instead of googling why learn X, or why X is good, you must type why NOT learn X, or why X is bad. That always gives you a better impression of the language (or product, company, etc).

Unlike other programming languages (such as Python), I couldn’t find any strict critique or a huge shortcoming of Lisp. The main disadvantage seems to be that Lisp lacks extensive libraries.

You will find links below questioning this issue, but my overall impression was that Lisp is not an awful language (ahem), it is just suited for enlightened programmers — which I am not, neither you are.

Detailed History of Lisp

Lisp was the first FL eva, developed by John McCarthy at MIT in 1959. 3

Lisp Programming

Lisp, despite being completely FL during its creation, later integrated some of the imperative programming features as well. Many dialects of Lisp have been written since, Scheme being the simplest one to grasp the fundamentals of FL.

Lisp highly relies on lists (LISP = LISt Processing). If you want to see what Lisp is famous for, take a look at two symbols below:

( )

This is called S-expression, standing for symbolic expression. If you are going to type your Lisp code on a simple text editor, make sure that your keyboard’s Shift button works well.

Lisp Code

I can give a quick impression of how a Lisp code looks like with the following line, written in Scheme. It is a function for finding the cube of x.

(define (cube x) (* x x x))

Pay attention that the multiplication operator is written before atoms. The next line of code will display the cube of 5.

(display (cube 5))

Note that, input and output are not a part of a purely functional language, as they change the state of a program.

Which Lisp Dialect to Learn

Scheme is the cleanest, Common Lisp is the most pragmatic and ugly, Clojure is for Java lovers, Hy is for Python lovers. Forget about everything else (*gets sued by other dialect developers*). I would certainly start with Scheme. The following links are meant to create a better view of Lisp dialects, which I won’t include in the references section:

Books to Read

Almost in every forum and article discussing Lisp, I got a reference for two books: Structure and Interpretation of Computer Programs (a supernatural book, usually abbreviated as SICP), and The Little Schemer. It doesn’t mean that the books are great, but they scream for attention.

References and Further Reading


Footnotes

  1. How about trivia: John von Neumann (pronounced as “fohn Noymən”), despite his Germanized name, was born in Budapest. Neumann János Lajos was his real name, which now sounds exceptionally Hungarian, and he was able to divide 8-digit numbers in his head when he was 6 years old. A typical child prodigy. Von Neumann belonged to the group of elite Hungarian scientists (some years later!), known as The Martians, who emigrated to the United States in the early twentieth century. In Princeton, for example, he’d regularly blast out German march music on his phonograph, thus annoying everyone, including Albert Onestone. 

  2. NASA would also rely on Lisp. If the story goes correctly, NASA’s Deep Space 1 mission in 1998 encountered a subtle bug, which was detected only in space. The team was able to track down the race condition on time, fix the running code, and successfully conclude the experiments. Lisp fans will say that it was because of Lisp’s high readability. I will say that it was because the team members were smart. Probably both. 

  3. I’d rather write one well-researched and extremely detailed article, but as I tend to jump from one interest to another, I will try to complete the first draft of this essay as soon as possible. My curiosity already demands from me to read the 100 pages long research paper dedicated to the evolution of Lisp, which I will surely read (no) if I am ever going to have a passion to write another article about Lisp.