Introduction to Common Lisp

1.1 What is Common Lisp?

Common Lisp (CL) is a dialect of Lisp standardized by ANSI in 1994 (ANSI X3.226-1994). It unified the MacLisp-family dialects of the 1970s–80s (ZetaLisp, Spice Lisp, NIL, S-1 Lisp).

It's multi-paradigm (functional, imperative, object-oriented), dynamically and strongly typed (with optional type declarations), compiled (most implementations compile to native code), and image-based (you develop inside a live, modifiable running system).

1.2 Key Features

Interactive development REPL, incremental compilation, redefine anything while the program runs

Full-power, compile-time code transformation (the language is extensible)

Object system with multiple inheritance, multiple dispatch, method combination, and a meta-object protocol Condition system

Errors that can be handled without unwinding the stack, plus restarts Native compilation

SBCL generates fast machine code; type declarations enable C-like speed Rich numeric tower

Bignums, exact ratios, complex numbers, floats Stable standard

Code written decades ago still runs today Dynamic + optional static typing

declare/declaim types for safety and speed Save the entire running state as an executable Symbols and packages

First-class symbols, namespaced via packages Multiple implementations

SBCL, CCL, ECL, ABCL, CLISP, LispWorks, Allegro, Clasp

1.3 Where Common Lisp Is Used

Google Flights' QPX engine (ITA Software), Rigetti Computing's quantum compilers (Quil), Grammarly (historically), Ravenpack (financial data), Siscog (railway crew scheduling), PTC Creo Elements/Direct (CAD), Maxima (computer algebra), ACL2 (theorem prover), pgloader (PostgreSQL migration), NASA's Remote Agent (historically), Nyxt (browser), Lem (editor), and many research systems.

1.4 Lisp-2 and Other Defining Traits

Common Lisp is a Lisp-2: functions and variables live in separate namespaces. (list list) is legal: the first list is the function, the second is a variable. You refer to a function as a value with #'name (or (function name)) and call function values with funcall/apply.

nil is simultaneously the empty list, the false value, and a symbol. t is the canonical true value.

The reader upcases symbols by default: foo, Foo, and FOO are the same symbol FOO.