Common Lisp, short for Common Lisp Programming Language, was developed in the early 1980s by the Common Lisp Committee to standardize the divergent Lisp dialects of the time. Common Lisp is a multi-paradigm language supporting functional, procedural, and object-oriented programming, widely used in AI research, symbolic computation, and rapid prototyping. Developers can access Common Lisp through implementations such as SBCL or Clozure CL, which provide compilers, libraries, and documentation for Windows, macOS, and Linux platforms.

Common Lisp exists to unify the various Lisp dialects under a standard, offering a rich set of features while maintaining Lisp’s symbolic computing strengths. Its design philosophy emphasizes flexibility, extensibility, and efficiency. By supporting dynamic typing, macros, and a powerful object system (CLOS), Common Lisp solves the problem of building complex, interactive, and high-level software with a language that adapts to the programmer’s needs.

Common Lisp: Variables and Data Types

Common Lisp uses dynamically typed variables and provides a rich collection of built-in data types including numbers, strings, lists, arrays, and hash tables.

;; Variable definitions
(defparameter name "Common Lisp")
(defparameter age 40)
(defparameter numbers '(1 2 3 4 5))

(format t "Name: ~a, Age: ~a, Numbers: ~a~%" name age numbers)

Variables can be globally defined with defparameter or locally with let. Lists and symbols are core to data representation, conceptually similar to Scheme and Clojure.

Common Lisp: Functions and Macros

Common Lisp supports first-class functions and macros for metaprogramming.

(defun square (x)
  (* x x))

(defun describe-number (n)
(cond
((= n 0) "zero")
((= n 1) "one")
(t "other")))

(format t "Square of 5: ~a~%" (square 5))

Functions are defined with defun, while macros allow code transformation at compile time. This flexibility is similar to macro facilities in Clojure and function abstraction in Scheme.

Common Lisp: Control Structures and Iteration

Common Lisp provides various constructs for loops, recursion, and iteration.

(loop for i from 1 to 5
      do (format t "Iteration ~a~%" i))

The loop macro offers a readable, high-level iteration syntax, while recursion supports functional patterns. This control model is conceptually similar to loops and recursion in Scheme and Haskell.

Common Lisp: Object System (CLOS)

Common Lisp features the Common Lisp Object System (CLOS) for object-oriented programming.

(defclass person ()
  ((name :initarg :name :accessor person-name)
   (age :initarg :age :accessor person-age)))

(defmethod greet ((p person))
(format t "Hello, my name is ~a~%" (person-name p)))

(let ((alice (make-instance 'person :name "Alice" :age 30)))
(greet alice))

CLOS supports multiple inheritance, generic functions, and method combination, enabling sophisticated object-oriented designs similar to Clojure protocols and Racket objects.

Common Lisp is used in AI research, symbolic computing, and high-level system prototyping. Its combination of functional abstraction, macros, and object-oriented features makes it a versatile tool when used alongside Haskell, Scheme, and Clojure.