Lisp and Its Ideas

what is lisp programming language

Seen a wall of parentheses and wondered what is Lisp programming language, really? It is a family of languages begun by John McCarthy in which programs are written as nested lists, so a program can treat its own code as data.

This page belongs to our programming essays. It follows the handful of ideas Lisp introduced rather than touring syntax, and it uses one small expression to show each idea.

Where Lisp comes from

Lisp is one of the oldest languages still in real use. McCarthy’s own history of Lisp calls it the second oldest programming language in widespread use, after FORTRAN. A course summary from Gordon College says McCarthy, then at MIT, first developed it after the Dartmouth Conference of 1956. GeeksforGeeks dates its invention to 1958 at the Massachusetts Institute of Technology.

An open book and a blank open notebook on a wooden desk, with a laptop at the left edge.

Lisp also sits in a different tradition from most languages you will meet first. The Gordon College notes describe it as the earliest representative of the functional paradigm, with lambda calculus rather than the Turing machine as its model of computation. Functional code leans on functions that call themselves, a technique covered in how recursion works. For many years Lisp was also the lingua franca of AI work.

An open book stands in for the long reading trail behind Lisp. The print is too small to read, so the photo is purely illustrative.

McCarthy credits part of the language’s long life to one design choice. He writes that representing programs in the same way as data will probably give it a very long life. That choice is the thread through the rest of this page.

Common misunderstandings about Lisp

Most first impressions of Lisp come from its surface. The table sets the usual assumptions against what the language actually does.

Common assumption What is supported Planning use
It is just a pile of parentheses Lisp uses prefix notation, called Cambridge Polish Notation, and every expression is fully parenthesized. The first element names a function, macro or special form. Read the first item in each pair of parentheses as the operator and the rest as its arguments.
Code and data are different kinds of thing There is no syntactic distinction between functions and data. Expect to build, inspect and pass around code with the same list tools you use for any other list.
Lisp is a single language Incompatible dialects multiplied early on. Scheme survives as a standardized early dialect, and most implementations aim at the Common Lisp standard. Choose a dialect before you choose a tutorial.
Lisp is obsolete Its influence is visible in Python, JavaScript and Rust, and its interactive REPL is still a cornerstone of Lisp development. Treat it as a way to see ideas that other languages borrowed.

Figures and descriptions here draw on Gordon College’s Lisp notes and freeCodeCamp’s Lisp course overview.

A single expression as text, tree and data

An s-expression, short for symbolic expression, is the form Lisp uses for both code and data. The Gordon College notes point out that McCarthy’s original paper called data objects s-expressions. Take the ordinary arithmetic 1+2*3-4, which the same notes write in Lisp as (- (+ 1 (* 2 3)) 4). The same text can be read in three ways.

  • As text. The operator always comes first. The parentheses carry the grouping, so Lisp needs no precedence rules for operators.
  • As a tree. The minus sits at the root, with the plus-expression and 4 beneath it. The plus holds 1 and the multiplication, and the multiplication holds 2 and 3. Every pair of parentheses is one branching node.
  • As evaluated data. Evaluation works from the innermost list outward: the multiplication first, then the plus, then the minus. Each step replaces a list with its result.

That is the honest answer to why Lisp has so many parentheses. Each pair marks one node of the tree, and writing the tree out in full is what lets code and data share a shape. Once you can sketch the tree on paper, the notation stops looking noisy.

Code is data: homoiconicity

Homoiconicity means a language writes its programs in its own basic data structure. In Lisp that structure is the list. The Gordon College notes say there is absolutely no syntactic distinction between functions and data, and they illustrate it with the list (car ‘(volkswagen golf)). Here car is a function, the quoted list is plain data, and the result is the first element, volkswagen.

Lists are built from pairs. The notes explain that dotted pairs are how Lisp represents lists internally, so the list (this is a list) is stored as (this . (is . (a . (list . nil)))). A program is therefore a chain of pairs, and a program that can walk a list can walk code. This groundwork leads to macros, which Lisp courses such as freeCodeCamp’s list among the features worth mastering, alongside lists and closures.

The REPL and working interactively

The REPL, or Read-Eval-Print Loop, reads one expression, evaluates it and prints the result. freeCodeCamp’s course overview calls it a cornerstone of Lisp development that makes experimenting with code intuitive and interactive. GeeksforGeeks adds that Lisp lets you create and update programs and applications dynamically.

For a beginner the practical benefit is small steps. Type an expression, see what it returns, then wrap it in another. Because Lisp is built from nested expressions, each inner piece can be tested on its own before you assemble the whole.

Scheme and Common Lisp

Scheme and Common Lisp are the two dialects most newcomers meet, and they are different languages with a shared core of lists and prefix notation. The Gordon College notes explain that incompatible dialects multiplied as Lisp was implemented on different platforms. A standardization effort in 1984 produced Common Lisp, which became an ANSI standard in 1994. Most implementations of Lisp now try to adhere to it.

Glasses rest in front of monitors displaying multiple code editor panes; the code text is blurred and not legible.
  • Scheme. An early dialect that has survived to the present day and is itself standardized. Ideas first pioneered in Scheme, such as static versus dynamic scoping of names, later found their way into Common Lisp.
  • Common Lisp. The broader standardized language, with special variables that work much like global variables elsewhere. The freeCodeCamp course covers REPL work, lists, macros, closures and CLOS in Common Lisp.

The choice follows from your goal. If a book or course is built on one dialect, learn that one, because the differences will trip you up more than the shared ideas help. If you have no course in mind, pick one and stay with it until the list and tree habits feel natural. Switching later is easier once those ideas are familiar.

Is Lisp worth learning today?

Yes, if your aim is understanding rather than a quick route to a particular job. freeCodeCamp notes that Lisp has more than six decades of influence on computer science, with its ideas visible in Python, JavaScript and Rust. Learning it shows where those ideas started, and it shows the code-as-data design McCarthy credited for the language’s long life.

A stock image of a reader stuck at a laptop. The screen shows no code, so it only stands for the early frustration of unfamiliar notation.

Expect an adjustment period. Prefix notation and heavy nesting feel odd at first, and the quickest fix is to sketch the tree for any expression that looks confusing. It is a poor fit if you want a language with familiar infix syntax, since Lisp’s whole design rests on the opposite choice.

Frequently asked questions

Question Answer
Is Lisp case sensitive? No. According to the Gordon College notes, word, Word and WORD are equivalent symbols.
Is Lisp statically typed? No. Lisp is dynamically typed, so a variable does not have a declared type.
What is special about the empty list? Written () or nil, it is the only s-expression that is both a symbol, and therefore an atom, and a list. It also ends every proper list in the dotted-pair form.