{
  "id": "lisp-programming-language",
  "title": "Lisp (Programming Language)",
  "lang": "en",
  "source_lang": "en",
  "summary": "Lisp is a family of programming languages originating in 1958, distinguished by symbolic computation, list-based syntax, automatic memory management, and powerful facilities for manipulating programs as data.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "LISP",
    "Lisp language family"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/lisp-programming-language/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/lisp-programming-language/",
      "json": "https://aiwiki.page/zh/lisp-programming-language.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Lisp is a family of general-purpose programming languages that originated with John McCarthy in 1958. Its name derives from “list processing,” reflecting its original emphasis on manipulating symbolic expressions rather than primarily numerical data. Lisp introduced or helped establish many influential programming techniques, including automatic memory management, recursive symbolic computation, interactive development, and program transformation through macros. Although historically associated with artificial intelligence, Lisp is not restricted to that field. Modern Lisp languages include Common Lisp, Scheme, Clojure, and Emacs Lisp, which share important ideas but differ substantially in their semantics and practical uses."
    },
    {
      "heading": "Origins and historical development",
      "text": "McCarthy developed Lisp at the Massachusetts Institute of Technology as a language for symbolic computation. His 1960 paper, Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I, presented its theoretical foundations and an evaluator expressed in terms of a small set of operations.\n\nEarly Lisp development included an implementation on the IBM 704. The traditional names car and cdr, used to access the two components of a pair, originated in terminology associated with that machine’s registers. These operations became enduring parts of Lisp vocabulary even after their hardware origins ceased to matter.\n\nLisp’s development was closely connected with early symbolic artificial intelligence. Its ability to represent expressions, rules, and programs using similar structures made it suitable for automated reasoning, language processing, and experimental problem-solving systems.\n\nRather than remaining a single standardized language, Lisp developed into numerous dialects. Important historical implementations included Lisp 1.5, Maclisp, and Interlisp. During the 1970s and 1980s, specialized Lisp machines provided tightly integrated environments for editing, executing, and debugging Lisp programs. These systems supported influential forms of interactive software development, but their commercial role declined as general-purpose workstations became more capable.\n\nCommon Lisp emerged during the 1980s to consolidate features from several existing dialects. It became an ANSI standard in 1994. Scheme, introduced in 1975 by Gerald Jay Sussman and Guy L. Steele Jr., pursued a smaller language design with an emphasis on lexical scope and precise semantics. Later dialects adapted Lisp ideas to other platforms and applications."
    },
    {
      "heading": "Expressions, lists, and symbolic data",
      "text": "S-expressions and prefix notation\n\nThe characteristic notation of Lisp uses S-expressions, or symbolic expressions. In their traditional form, these consist of atoms, such as symbols and numbers, and structures built from pairs. Parentheses provide a readable notation for lists and nested expressions.\n\nA typical function call places the function before its arguments:\n\n(+ 2 3)\n\nThis expression evaluates to 5. Expressions can be nested directly:\n\n(* (+ 2 3) 4)\n\nThe result is 20. Parentheses make the grouping explicit, reducing dependence on precedence rules.\n\nNot every parenthesized form is an ordinary function call. Languages in the Lisp family also provide special forms and macros whose evaluation rules differ from those of functions. For example, a conditional must be able to choose which branch to evaluate rather than evaluating every branch in advance.\n\nPairs, lists, and symbols\n\nA traditional Lisp list is built from cons cells, each containing two components. The first holds an element; the second refers to the rest of the list. A proper list ends in the empty list. The operations cons, car, and cdr construct a pair and access its components.\n\nLists are only one kind of data structure in modern Lisp systems. Depending on the dialect, implementations also provide arrays, strings, hash tables, records, objects, and other collections.\n\nSymbols are distinct objects used as names and as symbolic data. They are not simply strings: a symbol may participate in variable binding, function naming, namespace organization, and other language mechanisms.\n\nIn Common Lisp, quotation prevents an expression from being evaluated in the usual way:\n\n'(+ 2 3)\n\nThis yields a list containing the symbol + and the numbers 2 and 3, rather than the number 5. The apostrophe abbreviates the quote form.\n\nCommon Lisp uses nil both for the empty list and for Boolean false. This convention is not universal across the family: Scheme distinguishes its empty list from its false value."
    },
    {
      "heading": "Programs as data and macros",
      "text": "A defining feature of Lisp is the close relationship between program notation and ordinary data structures. The reader converts textual program notation into objects that can also be inspected and manipulated by programs. This property is commonly described as homoiconicity.\n\nThe correspondence is not absolute. A running program may be compiled into machine instructions, and lexical environments or compiled functions are not simply source-code lists. The important point is that a useful representation of program structure is directly available through the language’s data model.\n\nThis supports macros: transformations that produce program forms from other forms before the resulting code is evaluated or compiled. Unlike ordinary functions, macros can introduce new binding constructs, control structures, and application-specific syntax.\n\nFor example, a macro can accept a body of expressions and arrange for that body to execute conditionally, repeatedly, or within a managed resource context. Because the input is structured, Lisp macros generally operate on program forms rather than performing simple textual substitution.\n\nMacro systems differ across dialects. Traditional Common Lisp macros provide explicit control over generated forms; programmers must avoid unintended variable capture, often by generating fresh symbols. Scheme is particularly associated with hygienic macro systems, which prevent many accidental binding interactions automatically.\n\nMacros can improve abstraction, but they also introduce complexity. Poorly designed transformations can obscure evaluation order, complicate error messages, or make code difficult to understand without inspecting its expansion."
    },
    {
      "heading": "Evaluation, functions, and scope",
      "text": "Lisp languages were influential in the development of functional programming. They commonly support functions as values: functions can be passed as arguments, returned as results, and stored in data structures. Anonymous functions are conventionally written using lambda, a name derived from lambda calculus.\n\nMost widely used Lisp dialects are not purely functional. They also support mutable state, assignment, input and output, and imperative control flow.\n\nRecursion is central to traditional Lisp programming because recursive functions naturally process nested lists and trees. The following Common Lisp example computes a factorial for a nonnegative integer:\n\n(defun factorial (n)\n  (if (zerop n)\n      1\n      (* n (factorial (1- n)))))\n\nLisp languages differ in several important semantic choices:\n\n- Scope: Modern Common Lisp ordinarily uses lexical scope, while also providing dynamically scoped special variables. Scheme uses lexical scope. Emacs Lisp supports both lexical and dynamic binding, depending on the code’s binding mode.\n- Namespaces: Common Lisp separates function bindings from variable bindings. Scheme generally uses a single namespace for both.\n- Tail calls: Scheme requires proper tail recursion, allowing certain recursive computations to proceed without unbounded growth of active control state. Common Lisp does not impose the same general guarantee.\n- Evaluation order: Rules for evaluating argument expressions vary by dialect; code should not assume that all Lisp languages follow the same order."
    },
    {
      "heading": "Memory management and implementation",
      "text": "Lisp was an early and influential setting for garbage collection, which automatically reclaims memory occupied by objects that are no longer reachable. This is especially useful for programs that continually construct and discard lists, trees, and intermediate symbolic expressions.\n\nAutomatic memory management does not eliminate all memory problems. Programs can retain unnecessary references, allocate excessively, or encounter pauses associated with collection. The details depend on the implementation and collector.\n\nLisp is sometimes characterized as an interpreted language, but this is incomplete. Lisp systems have long included compilers, and modern implementations may generate native machine code or execute through a virtual machine. Interactive evaluation and compilation are compatible: an environment may compile functions as they are entered or redefined.\n\nMany dialects use dynamic typing, meaning that values have types checked during execution rather than requiring every variable to have a fixed, statically enforced type. Some implementations use declarations and inferred information to improve diagnostics or optimize generated code."
    },
    {
      "heading": "Major dialects",
      "text": "Dialect | Principal characteristics\n**[[common-lisp | Common Lisp]]**\n**[[scheme-programming-language | Scheme]]**\n**[[clojure | Clojure]]**\n**[[emacs-lisp | Emacs Lisp]]**\n**[[racket-programming-language | Racket]]**\n\nThese dialects are not generally source-compatible. Their shared syntax and concepts do not remove differences in libraries, module systems, numeric behavior, macro expansion, or runtime facilities.\n\nCommon Lisp’s Common Lisp Object System supports object-oriented programming through classes, generic functions, and methods. Its multiple dispatch allows method selection to depend on more than one argument. This differs from object systems organized primarily around sending a message to a single receiver."
    },
    {
      "heading": "Interactive development",
      "text": "Lisp environments are strongly associated with the read–eval–print loop, or REPL. A REPL reads an expression, evaluates it, displays the result, and repeats. Programmers can use this interaction to test expressions, inspect values, redefine functions, and investigate running programs.\n\nMore elaborate environments integrate the REPL with editors, debuggers, inspectors, and compilation tools. Some systems allow execution to be suspended after an error while the programmer inspects state or changes definitions.\n\nCommon Lisp’s condition system distinguishes signaling an exceptional situation from deciding how to recover. Restarts can expose recovery actions that a handler or interactive debugger may select. These facilities support development within a running process, although their availability and behavior vary between implementations."
    },
    {
      "heading": "Applications and influence",
      "text": "Lisp has been used in symbolic reasoning, planning, computer algebra, language implementation, editor customization, and commercial applications. Its combination of symbolic data and macros is particularly suitable for building domain-specific languages.\n\nIts historical relationship with AI concerns especially symbolic methods, including rule-based systems and structured reasoning. Lisp is not inherently limited to those methods, nor does its historical role imply that it is the dominant language of contemporary machine learning.\n\nLisp also influenced broader language design through first-class functions, closures, garbage collection, expression-oriented programming, interactive evaluation, and extensible syntax. Many of these ideas now appear in languages with very different surface notation."
    },
    {
      "heading": "Limitations and practical trade-offs",
      "text": "Lisp’s uniform syntax reduces the number of distinct grammatical constructions, but deeply nested expressions can be difficult to read without appropriate formatting and editor support. Familiarity with parenthesized notation does not by itself resolve the complexity of a large program.\n\nDialect diversity creates another practical limitation. Libraries and tools for one Lisp language may not transfer directly to another. Integration with external libraries, deployment systems, and platform-specific interfaces varies significantly by implementation.\n\nPerformance cannot be inferred solely from the language family. Native compilers can produce efficient code, while allocation patterns, data representation, dynamic dispatch, and implementation-specific optimizations can strongly affect results. Garbage-collection pauses may also matter in applications with strict latency requirements.\n\nFinally, powerful metaprogramming shifts responsibility toward library and language designers. Well-designed abstractions can make application code concise; excessive or inconsistent syntactic extension can make maintenance and debugging harder."
    }
  ],
  "links": [
    "programming-language",
    "john-mccarthy",
    "artificial-intelligence",
    "symbolic-artificial-intelligence",
    "data-structure",
    "functional-programming",
    "lambda-calculus",
    "recursion",
    "garbage-collection",
    "compiler",
    "virtual-machine",
    "object-oriented-programming"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}