HOME

TheInfoList



OR:

Lisp (historically LISP) is a family of
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s with a long history and a distinctive, fully parenthesized
prefix notation Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation or simply prefix notation, is a mathematical notation in which operators ''precede'' their operands, in contrast t ...
. Originally specified in 1960, Lisp is the second-oldest
high-level programming language In computer science, a high-level programming language is a programming language with strong Abstraction (computer science), abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ...
still in common use, after Fortran. Lisp has changed since its early days, and many
dialects The term dialect (from Latin , , from the Ancient Greek word , 'discourse', from , 'through' and , 'I speak') can refer to either of two distinctly different types of linguistic phenomena: One usage refers to a variety of a language that is a ...
have existed over its history. Today, the best-known general-purpose Lisp dialects are
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
,
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
, Racket and
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
. Lisp was originally created as a practical
mathematical notation Mathematical notation consists of using symbols for representing operations, unspecified numbers, relations and any other mathematical objects, and assembling them into expressions and formulas. Mathematical notation is widely used in mathematic ...
for
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
s, influenced by (though not originally derived from) the notation of
Alonzo Church Alonzo Church (June 14, 1903 – August 11, 1995) was an American mathematician, computer scientist, logician, philosopher, professor and editor who made major contributions to mathematical logic and the foundations of theoretical computer scienc ...
's
lambda calculus Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation ...
. It quickly became a favored programming language for
artificial intelligence Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech re ...
(AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, including tree data structures,
automatic storage management Automatic Storage Management (ASM) is a feature provided by Oracle Corporation within the Oracle Database from release Oracle 10g (revision 1) onwards. ASM aims to simplify the management of database datafiles, control files and log files. To do s ...
,
dynamic typing In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
,
conditionals Conditional (if then) may refer to: *Causal conditional, if X then Y, where X is a cause of Y *Conditional probability, the probability of an event A given that another event B has occurred *Conditional proof, in logic: a proof that asserts a co ...
,
higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s,
recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
, the
self-hosting compiler In computer programming, self-hosting is the use of a program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is co ...
, and the
read–eval–print loop A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written ...
. The name ''LISP'' derives from "LISt Processor".
Linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whic ...
s are one of Lisp's major
data structure In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
s, and Lisp
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
is made of lists. Thus, Lisp programs can manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or new
domain-specific language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging f ...
s embedded in Lisp. The interchangeability of code and data gives Lisp its instantly recognizable syntax. All program code is written as ''
s-expression In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
s'', or parenthesized lists. A function call or syntactic form is written as a list with the function or operator's name first, and the arguments following; for instance, a function that takes three arguments would be called as .


History

John McCarthy began developing Lisp in 1958 while he was at the
Massachusetts Institute of Technology The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of the ...
(MIT). McCarthy published its design in a paper in ''
Communications of the ACM ''Communications of the ACM'' is the monthly journal of the Association for Computing Machinery (ACM). It was established in 1958, with Saul Rosen as its first managing editor. It is sent to all ACM members. Articles are intended for readers with ...
'' in April 1960, entitled "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I". He showed that with a few simple operators and a notation for anonymous functions borrowed from Church, one can build a
Turing-complete In computability theory, a system of data-manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be used to simulate any Tur ...
language for algorithms.
Information Processing Language Information Processing Language (IPL) is a programming language created by Allen Newell, Cliff Shaw, and Herbert A. Simon at RAND Corporation and the Carnegie Institute of Technology about 1956. Newell had the job of language specifier-applicatio ...
was the first AI language, from 1955 or 1956, and already included many of the concepts, such as list-processing and recursion, which came to be used in Lisp. McCarthy's original notation used bracketed "
M-expression In computer programming, M-expressions (or meta-expressions) were an early proposed syntax for the Lisp programming language, inspired by contemporary languages such as Fortran and ALGOL. The notation was never implemented into the language and, ...
s" that would be translated into
S-expression In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
s. As an example, the M-expression is equivalent to the S-expression . Once Lisp was implemented, programmers rapidly chose to use S-expressions, and M-expressions were abandoned. M-expressions surfaced again with short-lived attempts of
MLisp :''"MLisp" is also another name for Mocklisp, a stripped-down version of Lisp used as an extension language in Gosling Emacs.'' MLISP is a variant of Lisp with an Algol-like syntax based on M-Expressions, which were the function syntax in ...
by Horace Enea and
CGOL CGOL (pronounced ''"see goll"'') is an alternative syntax featuring an extensible algebraic notation for the Lisp programming language. It was designed for MACLISP by Vaughan Pratt and subsequently ported to Common Lisp. The notation of CGOL ...
by
Vaughan Pratt Vaughan Pratt (born April 12, 1944) is a Professor Emeritus at Stanford University, who was an early pioneer in the field of computer science. Since 1969, Pratt has made several contributions to foundational areas such as search algorithms, sorti ...
. Lisp was first implemented by Steve Russell on an
IBM 704 The IBM 704 is a large digital mainframe computer introduced by IBM in 1954. It was the first mass-produced computer with hardware for floating-point arithmetic. The IBM 704 ''Manual of operation'' states: The type 704 Electronic Data-Pro ...
computer using
punched card A punched card (also punch card or punched-card) is a piece of stiff paper that holds digital data represented by the presence or absence of holes in predefined positions. Punched cards were once common in data processing applications or to di ...
s. Russell had read McCarthy's paper and realized (to McCarthy's surprise) that the Lisp ''eval'' function could be implemented in
machine code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
. According to McCarthy: The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly, "evaluate Lisp expressions". Two
assembly language macros In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence be ...
for the
IBM 704 The IBM 704 is a large digital mainframe computer introduced by IBM in 1954. It was the first mass-produced computer with hardware for floating-point arithmetic. The IBM 704 ''Manual of operation'' states: The type 704 Electronic Data-Pro ...
became the primitive operations for decomposing lists: (''Contents of the Address part of Register'' number) and (''Contents of the Decrement part of Register'' number), where "register" refers to registers of the computer's
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, an ...
(CPU). Lisp dialects still use and ( and ) for the operations that return the first item in a list and the rest of the list, respectively. The first complete Lisp compiler, written in Lisp, was implemented in 1962 by Tim Hart and Mike Levin at MIT, and could be compiled by simply having an existing LISP interpreter interpret the compiler code, producing
machine code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
output able to be executed at a 40-fold improvement in speed over that of the interpreter. This compiler introduced the Lisp model of
incremental compilation An incremental compiler is a kind of incremental computation applied to the field of compilation. Quite naturally, whereas ordinary compilers make a so-called clean build, that is, (re)build all program modules, an incremental compiler recompiles o ...
, in which compiled and interpreted functions can intermix freely. The language used in Hart and Levin's memo is much closer to modern Lisp style than McCarthy's earlier code.
Garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
routines were developed by MIT graduate student
Daniel Edwards Daniel Edwards (born 1965 in La Porte, Indiana) is an American contemporary artist whose pieces address celebrity and popular culture in ways that have often stirred controversy. The release of the pieces is generally accompanied by press releas ...
, prior to 1962. During the 1980s and 1990s, a great effort was made to unify the work on new Lisp dialects (mostly successors to Maclisp such as
ZetaLisp Lisp Machine Lisp is a programming language, a dialect of the language Lisp. A direct descendant of Maclisp, it was initially developed in the mid to late 1970s as the system programming language for the Massachusetts Institute of Technology ( ...
and NIL (New Implementation of Lisp) into a single language. The new language,
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
, was somewhat compatible with the dialects it replaced (the book ''
Common Lisp the Language ''Common Lisp the Language'' is a reference book by Guy L. Steele about a set of technical standards and programming languages named Common Lisp. History Before standardizing The first edition (Digital Press, 1984; ; 465 pages) was written by Guy ...
'' notes the compatibility of various constructs). In 1994,
ANSI The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organi ...
published the Common Lisp standard, "ANSI X3.226-1994 Information Technology Programming Language Common Lisp".


Timeline


Connection to artificial intelligence

Since inception, Lisp was closely connected with the
artificial intelligence Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech re ...
research community, especially on
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
The 36-bit word size of the
PDP-6 The PDP-6, short for Programmed Data Processor model 6, is a computer developed by Digital Equipment Corporation (DEC) during 1963 and first delivered in the summer of 1964. It was an expansion of DEC's existing 18-bit systems to use a 36-bit da ...
/
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
was influenced by the usefulness of having two Lisp 18-bit pointers in a single word.
systems. Lisp was used as the implementation of the language Micro Planner, which was used in the famous AI system
SHRDLU SHRDLU was an early natural-language understanding computer program, developed by Terry Winograd at MIT in 1968–1970. In the program, the user carries on a conversation with the computer, moving objects, naming collections and querying the st ...
. In the 1970s, as AI research spawned commercial offshoots, the performance of existing Lisp systems became a growing issue, as programmers needed to be familiar with the performance ramifications of the various techniques and choices involved in the implementation of Lisp.


Genealogy and variants

Over its sixty-year history, Lisp has spawned many variations on the core theme of an S-expression language. Moreover, each given dialect may have several implementations—for instance, there are more than a dozen implementations of
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
. Differences between dialects may be quite visible—for instance, Common Lisp uses the keyword defun to name a function, but Scheme uses define.Common Lisp: (defun f (x) x)
Scheme: (define f (lambda (x) x)) or (define (f x) x)
Within a dialect that is standardized, however, conforming implementations support the same core language, but with different extensions and libraries.


Historically significant dialects

* LISP 1 Accessed May 11, 2010. – First implementation. * LISP 1.5 – First widely distributed version, developed by McCarthy and others at MIT. So named because it contained several improvements on the original "LISP 1" interpreter, but was not a major restructuring as the planned
LISP 2 LISP 2 was a programming language proposed in the 1960s as the successor to Lisp. It had largely Lisp-like semantics and Algol 60-like syntax. Today it is mostly remembered for its syntax, but in fact it had many features beyond those of early Li ...
would be. * Stanford LISP 1.6 – This was a successor to LISP 1.5 developed at the
Stanford AI Lab Stanford University has many centers and institutes dedicated to the study of various specific topics. These centers and institutes may be within a department, within a school but across departments, an independent laboratory, institute or center ...
, and widely distributed to
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
systems running the
TOPS-10 TOPS-10 System (''Timesharing / Total Operating System-10'') is a discontinued operating system from Digital Equipment Corporation (DEC) for the PDP-10 (or DECsystem-10) mainframe computer family. Launched in 1967, TOPS-10 evolved from the earlier ...
operating system. It was rendered obsolete by Maclisp and InterLisp. * MACLISP – developed for MIT's
Project MAC Computer Science and Artificial Intelligence Laboratory (CSAIL) is a research institute at the Massachusetts Institute of Technology (MIT) formed by the 2003 merger of the Laboratory for Computer Science (LCS) and the Artificial Intelligence Lab ...
, MACLISP is a direct descendant of LISP 1.5. It ran on the PDP-10 and
Multics Multics ("Multiplexed Information and Computing Service") is an influential early time-sharing operating system based on the concept of a single-level memory.Dennis M. Ritchie, "The Evolution of the Unix Time-sharing System", Communications of t ...
systems. MACLISP would later come to be called Maclisp, and is often referred to as MacLisp. The "MAC" in MACLISP is related neither to Apple's
Macintosh The Mac (known as Macintosh until 1999) is a family of personal computers designed and marketed by Apple Inc., Apple Inc. Macs are known for their ease of use and minimalist designs, and are popular among students, creative professionals, and ...
nor to McCarthy. *
Interlisp Interlisp (also seen with a variety of capitalizations) is a programming environment built around a version of the programming language Lisp. Interlisp development began in 1966 at Bolt, Beranek and Newman (renamed BBN Technologies) in Cambridge, ...
– developed at
BBN Technologies Raytheon BBN (originally Bolt Beranek and Newman Inc.) is an American research and development company, based next to Fresh Pond in Cambridge, Massachusetts, United States. In 1966, the Franklin Institute awarded the firm the Frank P. Brown ...
for PDP-10 systems running the TENEX operating system, later adopted as a "West coast" Lisp for the Xerox Lisp machines as InterLisp-D. A small version called "InterLISP 65" was published for the
6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small te ...
-based
Atari 8-bit family The Atari 8-bit family is a series of 8-bit home computers introduced by Atari, Inc. in 1979 as the Atari 400 and Atari 800. The series was successively upgraded to Atari 1200XL , Atari 600XL, Atari 800XL, Atari 65XE, Atari 130XE, Atari 800XE, ...
computer line. For quite some time, Maclisp and InterLisp were strong competitors. *
Franz Lisp In computer programming, Franz Lisp is a discontinued Lisp programming language system written at the University of California, Berkeley (UC Berkeley, UCB) by Professor Richard Fateman and several students, based largely on Maclisp and distribu ...
– originally a
University of California, Berkeley The University of California, Berkeley (UC Berkeley, Berkeley, Cal, or California) is a public land-grant research university in Berkeley, California. Established in 1868 as the University of California, it is the state's first land-grant u ...
project; later developed by Franz Inc. The name is a humorous deformation of the name "
Franz Liszt Franz Liszt, in modern usage ''Liszt Ferenc'' . Liszt's Hungarian passport spelled his given name as "Ferencz". An orthographic reform of the Hungarian language in 1922 (which was 36 years after Liszt's death) changed the letter "cz" to simpl ...
", and does not refer to
Allegro Common Lisp Allegro Common Lisp is a programming language with an integrated development environment (IDE), developed by Franz Inc. It is a dialect of the language Lisp, a commercial software implementation of the language Common Lisp. Allegro CL provides ...
, the dialect of Common Lisp sold by Franz Inc., in more recent years. *
XLISP XLISP is a family of Lisp (programming language), Lisp implementations written by David Betz and first released in 1983. The first version was a Lisp with object-oriented programming, object-oriented extensions for computers with limited power. Th ...
, which
AutoLISP AutoLISP is a Dialect (computing), dialect of the programming language Lisp (programming language), Lisp built specifically for use with the full version of AutoCAD and its derivatives, which include ''AutoCAD Map 3D'', ''AutoCAD Architecture'' and ...
was based on. *
Standard Lisp Standard may refer to: Symbols * Colours, standards and guidons, kinds of military signs * Standard (emblem), a type of a large symbol or emblem used for identification Norms, conventions or requirements * Standard (metrology), an object th ...
and
Portable Standard Lisp Portable Standard Lisp (PSL) is a programming language, a dialect of the language Lisp. PSL was inspired by its predecessor, ''Standard Lisp'' and the Portable Lisp Compiler. It is tail-recursive, late binding (or dynamically bound), and was deve ...
were widely used and ported, especially with the Computer Algebra System REDUCE. *
ZetaLisp Lisp Machine Lisp is a programming language, a dialect of the language Lisp. A direct descendant of Maclisp, it was initially developed in the mid to late 1970s as the system programming language for the Massachusetts Institute of Technology ( ...
, also termed Lisp Machine Lisp – used on the
Lisp machine Lisp machines are general-purpose computers designed to efficiently run Lisp as their main software and programming language, usually via hardware support. They are an example of a high-level language computer architecture, and in a sense, the ...
s, direct descendant of Maclisp. ZetaLisp had a big influence on Common Lisp. *
LeLisp Le Lisp (also Le_Lisp and Le-Lisp) is a programming language, a dialect of the language Lisp. It was developed at the French Institute for Research in Computer Science and Automation (INRIA), to be an implementation language for a very large scal ...
is a French Lisp dialect. One of the first Interface Builders (called SOS InterfaceOutils de generation d'interfaces : etat de l'art et classification by H. El Mrabet
/ref>) was written in LeLisp. *
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
(1975). *
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
(1984), as described by ''
Common Lisp the Language ''Common Lisp the Language'' is a reference book by Guy L. Steele about a set of technical standards and programming languages named Common Lisp. History Before standardizing The first edition (Digital Press, 1984; ; 465 pages) was written by Guy ...
'' – a consolidation of several divergent attempts (ZetaLisp,
Spice Lisp Spice Lisp (Scientific Personal Integrated Computing Environment) is a programming language, a dialect of Lisp. Its implementation, originally written by Carnegie Mellon University's (CMU) Spice Lisp Group, targeted the microcode of the 16-bit w ...
,
NIL Nil may refer to: * nil (the number 0, zero) Acronyms * NIL (programming language), an implementation of the Lisp programming language * Student athlete compensation, Name, Image and Likeness, a set of rules in the American National Collegiate At ...
, and
S-1 Lisp S-1 Lisp was a Lisp implementation written in Lisp for the 36-bit pipelined S-1 Mark IIA supercomputer computer architecture, which has 32 megawords of RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater t ...
) to create successor dialects to Maclisp, with substantive influences from the Scheme dialect as well. This version of Common Lisp was available for wide-ranging platforms and was accepted by many as a
de facto standard A ''de facto'' standard is a custom or convention that has achieved a dominant position by public acceptance or market forces (for example, by early entrance to the market). is a Latin phrase (literally " in fact"), here meaning "in practice b ...
until the publication of ANSI Common Lisp (ANSI X3.226-1994). Among the most widespread sub-dialects of Common Lisp are Steel Bank Common Lisp (SBCL), CMU Common Lisp (CMU-CL), Clozure OpenMCL (not to be confused with Clojure!), GNU CLisp, and later versions of Franz Lisp; all of them adhere to the later ANSI CL standard (see below). * Dylan was in its first version a mix of Scheme with the Common Lisp Object System. *
EuLisp EuLisp is a statically and dynamically scoped Lisp dialect developed by a loose formation of industrial and academic Lisp users and developers from around Europe. The standardizers intended to create a new Lisp "less encumbered by the past" (c ...
– attempt to develop a new efficient and cleaned-up Lisp. *
ISLISP ISLISP (also capitalized as ISLisp) is a programming language in the Lisp family standardized by the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) joint working group ISO/IEC JTC 1/SC 22/W ...
– attempt to develop a new efficient and cleaned-up Lisp. Standardized as ISO/IEC 13816:1997 and later revised as ISO/IEC 13816:2007: ''Information technology – Programming languages, their environments and system software interfaces – Programming language ISLISP''. * IEEE
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
– IEEE standard, 1178–1990 (R1995). * ANSI
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
– an
American National Standards Institute The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organi ...
(ANSI)
standard Standard may refer to: Symbols * Colours, standards and guidons, kinds of military signs * Standard (emblem), a type of a large symbol or emblem used for identification Norms, conventions or requirements * Standard (metrology), an object th ...
for Common Lisp, created by subcommittee
X3J13 X3J13 is the name of a technical committee which was part of the International Committee for Information Technology Standards (INCITS, then named ''X3''). The X3J13 committee was formed in 1986 to draw up an American National Standards Institute (A ...
, chartered to begin with ''Common Lisp: The Language'' as a base document and to work through a public consensus process to find solutions to shared issues of portability of programs and compatibility of Common Lisp implementations. Although formally an ANSI standard, the implementation, sale, use, and influence of ANSI Common Lisp has been and continues to be seen worldwide. *
ACL2 ACL2 ("A Computational Logic for Applicative Common Lisp") is a software system consisting of a programming language, created by Timothy Still it was an extensible theory in a first-order logic, and an automated theorem prover. ACL2 is designed to ...
or "A Computational Logic for Applicative Common Lisp", an applicative (side-effect free) variant of Common LISP. ACL2 is both a programming language which can model computer systems, and a tool to help proving properties of those models. *
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
, a recent dialect of Lisp which compiles to the
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
and has a particular focus on
concurrency Concurrent means happening at the same time. Concurrency, concurrent, or concurrence may refer to: Law * Concurrence, in jurisprudence, the need to prove both ''actus reus'' and ''mens rea'' * Concurring opinion (also called a "concurrence"), a ...
. *
Game Oriented Assembly Lisp Game Oriented Assembly Lisp (GOAL) is a programming language, a dialect of the language Lisp, made for video games developed by Andy Gavin and the ''Jak and Daxter'' team at the company Naughty Dog. It was written using Allegro Common Lisp and us ...
(or GOAL) is a video game programming language developed by
Andy Gavin Andrew Scott Gavin (born June 11, 1970) is an American video game programmer, entrepreneur, and novelist. Gavin co-founded the video game company Naughty Dog with childhood friend Jason Rubin in 1986, which released games including ''Crash Bandico ...
at
Naughty Dog Naughty Dog, LLC (formerly JAM Software, Inc.) is an American first-party video game developer based in Santa Monica, California. Founded by Andy Gavin and Jason Rubin in 1984, the studio was acquired by Sony Computer Entertainment in 2001. Gav ...
. It was written using Allegro Common Lisp and used in the development of the entire Jak and Daxter series of games developed by Naughty Dog.


2000 to present

After having declined somewhat in the 1990s, Lisp has experienced a resurgence of interest after 2000. Most new activity has been focused around implementations of
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
,
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
,
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Ema ...
,
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
, and Racket, and includes development of new portable libraries and applications. Many new Lisp programmers were inspired by writers such as Paul Graham and
Eric S. Raymond Eric Steven Raymond (born December 4, 1957), often referred to as ESR, is an American software developer, open-source software advocate, and author of the 1997 essay and 1999 book ''The Cathedral and the Bazaar''. He wrote a guidebook for the ...
to pursue a language others considered antiquated. New Lisp programmers often describe the language as an eye-opening experience and claim to be substantially more productive than in other languages. This increase in awareness may be contrasted to the "
AI winter In the history of artificial intelligence, an AI winter is a period of reduced funding and interest in artificial intelligence research. , there were eleven actively maintained Common Lisp implementations. Scieneer Common Lisp is a new commercial implementation forked from CMUCL with a first release in 2002. The
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
community has created new supporting infrastructure:
CLiki CLiki is an open source wiki application Wiki software (also known as a wiki engine or a wiki application), is collaborative software that runs a wiki, which allows the users to create and collaboratively edit pages or entries via a web browser ...
is a wiki that collects Common Lisp related information, the Common Lisp directory lists resources, #lisp is a popular IRC channel and allows the sharing and commenting of code snippets (with support by lisppaste, an
IRC bot 409px, An IRC bot performing a simple task.An IRC bot is a set of scripts or an independent program that connects to Internet Relay Chat as a client, and so appears to other IRC users as another user. An IRC bot differs from a regular client in th ...
written in Lisp),
Planet Lisp A planet is a large, rounded astronomical body that is neither a star nor its remnant. The best available theory of planet formation is the nebular hypothesis, which posits that an interstellar cloud collapses out of a nebula to create a you ...
collects the contents of various Lisp-related blogs, on LispForum users discuss Lisp topics, Lispjobs is a service for announcing job offers and there is a weekly news service, '' Weekly Lisp News''. ''Common-lisp.net'' is a hosting site for open source Common Lisp projects.
Quicklisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived from ...
is a library manager for Common Lisp. Fifty years of Lisp (1958–2008) was celebrated at LISP50@OOPSLA. There are regular local user meetings in Boston, Vancouver, and Hamburg. Other events include the European Common Lisp Meeting, the European Lisp Symposium and an International Lisp Conference. The Scheme community actively maintains over twenty implementations. Several significant new implementations (Chicken, Gambit, Gauche, Ikarus, Larceny, Ypsilon) have been developed in the 2000s (decade). The Revised5 Report on the Algorithmic Language SchemeDocuments: Standards: R5RS
schemers.org (2012-01-11). Retrieved on 2013-07-17.
standard of Scheme was widely accepted in the Scheme community. The
Scheme Requests for Implementation Scheme Requests for Implementation (SRFI) is an effort to coordinate libraries and extensions of standard Scheme programming language, necessitated by Scheme's minimalist design, and particularly the lack of a standard library before Scheme R6RS. SR ...
process has created a lot of quasi standard libraries and extensions for Scheme. User communities of individual Scheme implementations continue to grow. A new language standardization process was started in 2003 and led to the R6RS Scheme standard in 2007. Academic use of Scheme for teaching computer science seems to have declined somewhat. Some universities are no longer using Scheme in their computer science introductory courses; MIT now uses
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
instead of Scheme for its undergraduate
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
program and MITx massive open online course. There are several new dialects of Lisp:
Arc ARC may refer to: Business * Aircraft Radio Corporation, a major avionics manufacturer from the 1920s to the '50s * Airlines Reporting Corporation, an airline-owned company that provides ticket distribution, reporting, and settlement services * ...
, Hy, Nu, Liskell, and LFE (Lisp Flavored Erlang). The parser for
Julia Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g. ...
is implemented in Femtolisp, a dialect of
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
(Julia is inspired by Scheme, which in turn is a Lisp dialect). In October 2019, Paul Graham release
a specification for Bel
"a new dialect of Lisp."


Major dialects

Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
and
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
represent two major streams of Lisp development. These languages embody significantly different design choices.
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
is a successor to Maclisp. The primary influences were
Lisp Machine Lisp Lisp Machine Lisp is a programming language, a dialect of the language Lisp. A direct descendant of Maclisp, it was initially developed in the mid to late 1970s as the system programming language for the Massachusetts Institute of Technology (M ...
, Maclisp,
NIL Nil may refer to: * nil (the number 0, zero) Acronyms * NIL (programming language), an implementation of the Lisp programming language * Student athlete compensation, Name, Image and Likeness, a set of rules in the American National Collegiate At ...
,
S-1 Lisp S-1 Lisp was a Lisp implementation written in Lisp for the 36-bit pipelined S-1 Mark IIA supercomputer computer architecture, which has 32 megawords of RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater t ...
,
Spice Lisp Spice Lisp (Scientific Personal Integrated Computing Environment) is a programming language, a dialect of Lisp. Its implementation, originally written by Carnegie Mellon University's (CMU) Spice Lisp Group, targeted the microcode of the 16-bit w ...
, and Scheme.Chapter 1.1.2, History, ANSI CL Standard It has many of the features of Lisp Machine Lisp (a large Lisp dialect used to program
Lisp Machine Lisp machines are general-purpose computers designed to efficiently run Lisp as their main software and programming language, usually via hardware support. They are an example of a high-level language computer architecture, and in a sense, the ...
s), but was designed to be efficiently implementable on any personal computer or workstation. Common Lisp is a general-purpose programming language and thus has a large language standard including many built-in data types, functions, macros and other language elements, and an object system (
Common Lisp Object System The Common Lisp Object System (CLOS) is the facility for object-oriented programming which is part of ANSI Common Lisp. CLOS is a powerful dynamic object system which differs radically from the OOP facilities found in more static languages such as ...
). Common Lisp also borrowed certain features from Scheme such as
lexical scoping In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts o ...
and
lexical closure In programming languages, a closure, also lexical closure or function closure, is a technique for implementing lexically scoped name binding in a language with first-class functions. Operationally, a closure is a record storing a function toge ...
s. Common Lisp implementations are available for targeting different platforms such as the
LLVM LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate represen ...
,
Clasp is a Common Lisp implementation that interoperates with C++ and uses LLVM for
just-in-time compilation In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may cons ...
(JIT) to native code.
the
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
,
"Armed Bear Common Lisp (ABCL) is a full implementation of the Common Lisp language featuring both an interpreter and a compiler, running in the JVM"
x86-64, PowerPC, Alpha, ARM, Motorola 68000, and MIPS,
Common Lisp Implementations: A Survey
and operating systems such as Windows, macOS, Linux, Solaris, FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, and Heroku.
Comparison of actively developed Common Lisp implementations
Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by
Guy L. Steele, Jr. Guy Lewis Steele Jr. (; born October 2, 1954) is an American computer scientist who has played an important role in designing and documenting several computer programming languages and technical standards. Biography Steele was born in Missouri ...
and
Gerald Jay Sussman Gerald Jay Sussman (born February 8, 1947) is the Panasonic Professor of Electrical Engineering at the Massachusetts Institute of Technology (MIT). He received his S.B. and Ph.D. degrees in mathematics from MIT in 1968 and 1973 respectively. ...
. It was designed to have exceptionally clear and simple semantics and few different ways to form expressions. Designed about a decade earlier than Common Lisp,
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
is a more minimalist design. It has a much smaller set of standard features but with certain implementation features (such as
tail-call optimization In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recu ...
and full
continuation In computer science, a continuation is an abstract representation of the control state of a computer program. A continuation implements ( reifies) the program control state, i.e. the continuation is a data structure that represents the computati ...
s) not specified in Common Lisp. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme. Scheme continues to evolve with a series of standards (Revisedn Report on the Algorithmic Language Scheme) and a series of
Scheme Requests for Implementation Scheme Requests for Implementation (SRFI) is an effort to coordinate libraries and extensions of standard Scheme programming language, necessitated by Scheme's minimalist design, and particularly the lack of a standard library before Scheme R6RS. SR ...
.
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
is a recent dialect of Lisp that targets mainly the
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
, and the
Common Language Runtime The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET Framework, manages the execution of .NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructio ...
(CLR), the
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
VM, the Ruby VM
YARV YARV (Yet another Ruby VM) is a bytecode interpreter that was developed for the Ruby programming language by Koichi Sasada. The goal of the project was to greatly reduce the execution time of Ruby programs. Since YARV has become the official Ru ...
, and compiling to
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
. It is designed to be a pragmatic general-purpose language. Clojure draws considerable influences from
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
and places a very strong emphasis on immutability.An In-Depth Look at Clojure Collections
Retrieved 2012-06-24
Clojure provides access to Java frameworks and libraries, with optional type hints and
type inference Type inference refers to the automatic detection of the type of an expression in a formal language. These include programming languages and mathematical type systems, but also natural languages in some branches of computer science and linguistics ...
, so that calls to Java can avoid reflection and enable fast primitive operations. Clojure is not designed to be backwards compatible with other Lisp dialects. Further, Lisp dialects are used as
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
s in many applications, with the best-known being
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Ema ...
in the
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
editor,
AutoLISP AutoLISP is a Dialect (computing), dialect of the programming language Lisp (programming language), Lisp built specifically for use with the full version of AutoCAD and its derivatives, which include ''AutoCAD Map 3D'', ''AutoCAD Architecture'' and ...
and later
Visual Lisp AutoLISP is a Dialect (computing), dialect of the programming language Lisp (programming language), Lisp built specifically for use with the full version of AutoCAD and its derivatives, which include ''AutoCAD Map 3D'', ''AutoCAD Architecture'' and ...
in
AutoCAD AutoCAD is a commercial computer-aided design (CAD) and drafting software application. Developed and marketed by Autodesk, AutoCAD was first released in December 1982 as a desktop app running on microcomputers with internal graphics controllers. ...
, Nyquist in Audacity, and Scheme in
LilyPond LilyPond is a computer program and file format for music engraving. One of LilyPond's major goals is to produce scores that are engraved with traditional layout rules, reflecting the era when scores were engraved by hand. LilyPond is cross-pl ...
. The potential small size of a useful Scheme interpreter makes it particularly popular for embedded scripting. Examples include
SIOD Scheme In One Defun, or humorously Scheme In One Day (SIOD) is a programming language, a dialect (computing), dialect of the language Lisp (programming language), Lisp, a small-size implementation of the dialect Scheme (programming language), Sch ...
and
TinyScheme TinyScheme is a free software implementation of the Scheme programming language with a lightweight Scheme interpreter of a subset of the R5RS standard. It is meant to be used as an embedded scripting interpreter for other programs. Much of the fu ...
, both of which have been successfully embedded in the
GIMP GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized task ...
image processor under the generic name "Script-fu".Script-fu In GIMP 2.4
Retrieved 2009-10-29
LIBREP, a Lisp interpreter by John Harper originally based on the
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Ema ...
language, has been embedded in the
Sawfish Sawfish, also known as carpenter sharks, are a family of rays characterized by a long, narrow, flattened rostrum, or nose extension, lined with sharp transverse teeth, arranged in a way that resembles a saw. They are among the largest fish wi ...
window manager A window manager is system software that controls the placement and appearance of windows within a windowing system in a graphical user interface. Most window managers are designed to help provide a desktop environment. They work in conjunction ...
.librep
at Sawfish Wikia, retrieved 2009-10-29


Standardized dialects

Lisp has officially standardized dialects:
R6RS Scheme Scheme is a dialect of the Lisp family of programming languages. Scheme was created during the 1970s at the MIT AI Lab and released by its developers, Guy L. Steele and Gerald Jay Sussman, via a series of memos now known as the Lambda Papers. ...
, R7RS Scheme, IEEE Scheme,
ANSI Common Lisp Common Lisp (CL) is a dialect of the Lisp (programming language), Lisp programming language, published in American National Standards Institute, ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Comm ...
and ISO
ISLISP ISLISP (also capitalized as ISLisp) is a programming language in the Lisp family standardized by the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) joint working group ISO/IEC JTC 1/SC 22/W ...
.


Language innovations

Paul Graham identifies nine important aspects of Lisp that distinguished it from existing languages like Fortran: *
Conditionals Conditional (if then) may refer to: *Causal conditional, if X then Y, where X is a cause of Y *Conditional probability, the probability of an event A given that another event B has occurred *Conditional proof, in logic: a proof that asserts a co ...
not limited to
goto GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function ca ...
*
First-class function In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from ...
s *
Recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
* Treating variables uniformly as
pointers Pointer may refer to: Places * Pointer, Kentucky * Pointers, New Jersey * Pointers Airport, Wasco County, Oregon, United States * The Pointers, a pair of rocks off Antarctica People with the name * Pointer (surname), a surname (including a l ...
, leaving types to values *
Garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
* Programs made entirely of expressions with no
statements Statement or statements may refer to: Common uses *Statement (computer science), the smallest standalone element of an imperative programming language *Statement (logic), declarative sentence that is either true or false *Statement, a declarative ...
* The
symbol A symbol is a mark, sign, or word that indicates, signifies, or is understood as representing an idea, object, or relationship. Symbols allow people to go beyond what is known or seen by creating linkages between otherwise very different conc ...
data type, distinct from the
string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
data type * Notation for code made of trees of symbols (using many
parentheses A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
) * Full language available at
load time In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them ...
,
compile time In computer science, compile time (or compile-time) describes the time window during which a computer program is compiled. The term is used as an adjective to describe concepts related to the context of program compilation, as opposed to concept ...
, and
run time Run(s) or RUN may refer to: Places * Run (island), one of the Banda Islands in Indonesia * Run (stream), a stream in the Dutch province of North Brabant People * Run (rapper), Joseph Simmons, now known as "Reverend Run", from the hip-hop group ...
Lisp was the first language where the structure of program code is represented faithfully and directly in a standard data structure—a quality much later dubbed "
homoiconicity In computer programming, homoiconicity (from the Greek words ''homo-'' meaning "the same" and ''icon'' meaning "representation") is a property of some programming languages. A language is homoiconic if a program written in it can be manipulated as ...
". Thus, Lisp functions can be manipulated, altered or even created within a Lisp program without lower-level manipulations. This is generally considered one of the main advantages of the language with regard to its expressive power, and makes the language suitable for syntactic macros and meta-circular evaluation. A conditional using an '' if–then–else'' syntax was invented by McCarthy for a chess program written in Fortran. He proposed its inclusion in
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
, but it was not made part of the
Algol 58 ALGOL 58, originally named IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60. According to John Backus The Zurich ACM-GAMM Conference had two principal motives in pro ...
specification. For Lisp, McCarthy used the more general ''cond''-structure.
Algol 60 ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a k ...
took up ''if–then–else'' and popularized it. Lisp deeply influenced
Alan Kay Alan Curtis Kay (born May 17, 1940) published by the Association for Computing Machinery 2012 is an American computer scientist best known for his pioneering work on object-oriented programming and windowing graphical user interface (GUI) d ...
, the leader of the research team that developed
Smalltalk Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Ka ...
at
Xerox PARC PARC (Palo Alto Research Center; formerly Xerox PARC) is a research and development company in Palo Alto, California. Founded in 1969 by Jacob E. "Jack" Goldman, chief scientist of Xerox Corporation, the company was originally a division of Xero ...
; and in turn Lisp was influenced by Smalltalk, with later dialects adopting object-oriented programming features (inheritance classes, encapsulating instances, message passing, etc.) in the 1970s. The
Flavors Flavor or flavour is either the sensory perception of taste or smell, or a flavoring in food that produces such perception. Flavor or flavour may also refer to: Science *Flavors (programming language), an early object-oriented extension to Lis ...
object system introduced the concept of
multiple inheritance Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or ...
and the
mixin In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depend ...
. The
Common Lisp Object System The Common Lisp Object System (CLOS) is the facility for object-oriented programming which is part of ANSI Common Lisp. CLOS is a powerful dynamic object system which differs radically from the OOP facilities found in more static languages such as ...
provides multiple inheritance, multimethods with
multiple dispatch Multiple dispatch or multimethods is a feature of some programming languages in which a function or method can be dynamically dispatched based on the run-time (dynamic) type or, in the more general case, some other attribute of more than one of ...
, and first-class
generic functions In computer programming, a generic function is a function defined for Polymorphism (computer science), polymorphism. In statically typed languages In statically typed languages (such as C++ and Java (programming language), Java), the term ''gen ...
, yielding a flexible and powerful form of
dynamic dispatch In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
. It has served as the template for many subsequent Lisp (including
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
) object systems, which are often implemented via a
metaobject protocol In computer science, a metaobject is an object that manipulates, creates, describes, or implements objects (including itself). The object that the metaobject pertains to is called the base object. Some information that a metaobject might define incl ...
, a
reflective Reflection is the change in direction of a wavefront at an interface between two different media so that the wavefront returns into the medium from which it originated. Common examples include the reflection of light, sound and water waves. The ' ...
meta-circular design in which the object system is defined in terms of itself: Lisp was only the second language after Smalltalk (and is still one of the very few languages) to possess such a metaobject system. Many years later, Alan Kay suggested that as a result of the confluence of these features, only Smalltalk and Lisp could be regarded as properly conceived object-oriented programming systems. Lisp introduced the concept of
automatic garbage collection In computer science, garbage collection (GC) is a form of automatic memory management. The ''garbage collector'' attempts to reclaim memory which was allocated by the program, but is no longer referenced; such memory is called ''garbage''. G ...
, in which the system walks the
heap Heap or HEAP may refer to: Computing and mathematics * Heap (data structure), a data structure commonly used to implement a priority queue * Heap (mathematics), a generalization of a group * Heap (programming) (or free store), an area of memory f ...
looking for unused memory. Progress in modern sophisticated garbage collection algorithms such as generational garbage collection was stimulated by its use in Lisp.
Edsger W. Dijkstra Edsger Wybe Dijkstra ( ; ; 11 May 1930 – 6 August 2002) was a Dutch computer scientist, programmer, software engineer, systems scientist, and science essayist. He received the 1972 Turing Award for fundamental contributions to developing progra ...
in his 1972
Turing Award The ACM A. M. Turing Award is an annual prize given by the Association for Computing Machinery (ACM) for contributions of lasting and major technical importance to computer science. It is generally recognized as the highest distinction in compu ...
lecture said, Largely because of its resource requirements with respect to early computing hardware (including early microprocessors), Lisp did not become as popular outside of the AI community as Fortran and the
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
-descended C language. Because of its suitability to complex and dynamic applications, Lisp enjoyed some resurgence of popular interest in the 2010s.


Syntax and semantics

:''Note: This article's examples are written in
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
(though most are also valid in
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
).''


Symbolic expressions (S-expressions)

Lisp is an expression oriented language. Unlike most other languages, no distinction is made between "expressions" and "statements"; all code and data are written as expressions. When an expression is ''evaluated'', it produces a value (in Common Lisp, possibly multiple values), which can then be embedded into other expressions. Each value can be any data type. McCarthy's 1958 paper introduced two types of syntax: ''Symbolic expressions'' (
S-expression In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
s, sexps), which mirror the internal representation of code and data; and ''Meta expressions'' (
M-expression In computer programming, M-expressions (or meta-expressions) were an early proposed syntax for the Lisp programming language, inspired by contemporary languages such as Fortran and ALGOL. The notation was never implemented into the language and, ...
s), which express functions of S-expressions. M-expressions never found favor, and almost all Lisps today use S-expressions to manipulate both code and data. The use of parentheses is Lisp's most immediately obvious difference from other programming language families. As a result, students have long given Lisp nicknames such as ''Lost In Stupid Parentheses'', or ''Lots of Irritating Superfluous Parentheses''. However, the S-expression syntax is also responsible for much of Lisp's power: the syntax is simple and consistent, which facilitates manipulation by computer. However, the syntax of Lisp is not limited to traditional parentheses notation. It can be extended to include alternative notations. For example, XMLisp is a Common Lisp extension that employs the
metaobject protocol In computer science, a metaobject is an object that manipulates, creates, describes, or implements objects (including itself). The object that the metaobject pertains to is called the base object. Some information that a metaobject might define incl ...
to integrate S-expressions with the Extensible Markup Language (
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
). The reliance on expressions gives the language great flexibility. Because Lisp functions are written as lists, they can be processed exactly like data. This allows easy writing of programs which manipulate other programs (
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
). Many Lisp dialects exploit this feature using macro systems, which enables extension of the language almost without limit.


Lists

A Lisp list is written with its elements separated by
whitespace White space or whitespace may refer to: Technology * Whitespace characters, characters in computing that represent horizontal or vertical space * White spaces (radio), allocated but locally unused radio frequencies * TV White Space Database, a mec ...
, and surrounded by parentheses. For example, is a list whose elements are the three ''atoms'' , , and . These values are implicitly typed: they are respectively two integers and a Lisp-specific data type called a "symbol", and do not have to be declared as such. The empty list is also represented as the special atom . This is the only entity in Lisp which is both an atom and a list. Expressions are written as lists, using
prefix notation Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation or simply prefix notation, is a mathematical notation in which operators ''precede'' their operands, in contrast t ...
. The first element in the list is the name of a function, the name of a macro, a lambda expression or the name of a "special operator" (see below). The remainder of the list are the arguments. For example, the function returns its arguments as a list, so the expression (list 1 2 (quote foo)) evaluates to the list . The "quote" before the in the preceding example is a "special operator" which returns its argument without evaluating it. Any unquoted expressions are recursively evaluated before the enclosing expression is evaluated. For example, (list 1 2 (list 3 4)) evaluates to the list . Note that the third argument is a list; lists can be nested.


Operators

Arithmetic operators are treated similarly. The expression (+ 1 2 3 4) evaluates to 10. The equivalent under
infix notation Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands—" infixed operators"—such as the plus sign in . Usage Binary relations a ...
would be "". Lisp has no notion of operators as implemented in Algol-derived languages. Arithmetic operators in Lisp are
variadic function In mathematics and in computer programming, a variadic function is a function of indefinite arity, i.e., one which accepts a variable number of arguments. Support for variadic functions differs widely among programming languages. The term ''varia ...
s (or ''n-ary''), able to take any number of arguments. A C-style '++' increment operator is sometimes implemented under the name incf giving syntax (incf x) equivalent to (setq x (+ x 1)), returning the new value of x. "Special operators" (sometimes called "special forms") provide Lisp's control structure. For example, the special operator takes three arguments. If the first argument is non-nil, it evaluates to the second argument; otherwise, it evaluates to the third argument. Thus, the expression (if nil (list 1 2 "foo") (list 3 4 "bar")) evaluates to . Of course, this would be more useful if a non-trivial expression had been substituted in place of . Lisp also provides logical operators and, or and not. The and and or operators do
short-circuit evaluation A short circuit (sometimes abbreviated to short or s/c) is an electrical circuit that allows a current to travel along an unintended path with no or very low electrical impedance. This results in an excessive current flowing through the circuit. ...
and will return their first nil and non-nil argument respectively. (or (and "zero" nil "never") "James" 'task 'time) will evaluate to "James".


Lambda expressions and function definition

Another special operator, , is used to bind variables to values which are then evaluated within an expression. This operator is also used to create functions: the arguments to are a list of arguments, and the expression or expressions to which the function evaluates (the returned value is the value of the last expression that is evaluated). The expression (lambda (arg) (+ arg 1)) evaluates to a function that, when applied, takes one argument, binds it to and returns the number one greater than that argument. Lambda expressions are treated no differently from named functions; they are invoked the same way. Therefore, the expression ((lambda (arg) (+ arg 1)) 5) evaluates to . Here, we're doing a function application: we execute the
anonymous function In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to ...
by passing to it the value 5. Named functions are created by storing a lambda expression in a symbol using the defun macro. (defun foo (a b c d) (+ a b c d)) defines a new function named in the global environment. It is conceptually similar to the expression: (setf (fdefinition 'f) #'(lambda (a) (block f b...))) where is a macro used to set the value of the first argument to a new function object. is a global function definition for the function named . is an abbreviation for special operator, returning a function object.


Atoms

In the original LISP there were two fundamental
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s: atoms and lists. A list was a finite ordered sequence of elements, where each element is either an atom or a list, and an atom was a
number A number is a mathematical object used to count, measure, and label. The original examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers c ...
or a symbol. A symbol was essentially a unique named item, written as an
alphanumeric Alphanumericals or alphanumeric characters are a combination of alphabetical and numerical characters. More specifically, they are the collection of Latin letters and Arabic digits. An alphanumeric code is an identifier made of alphanumeric ch ...
string in
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
, and used either as a variable name or as a data item in symbolic processing. For example, the list contains three elements: the symbol , the list , and the number 2. The essential difference between atoms and lists was that atoms were immutable and unique. Two atoms that appeared in different places in source code but were written in exactly the same way represented the same object, whereas each list was a separate object that could be altered independently of other lists and could be distinguished from other lists by comparison operators. As more data types were introduced in later Lisp dialects, and
programming style Programming style, also known as code style, is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers read and understand sour ...
s evolved, the concept of an atom lost importance. Many dialects still retained the predicate ''atom'' for
legacy compatibility Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially in ...
, defining it true for any object which is not a cons.


Conses and lists

A Lisp list is implemented as a
singly linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whic ...
. Each cell of this list is called a ''cons'' (in Scheme, a ''pair'') and is composed of two
pointers Pointer may refer to: Places * Pointer, Kentucky * Pointers, New Jersey * Pointers Airport, Wasco County, Oregon, United States * The Pointers, a pair of rocks off Antarctica People with the name * Pointer (surname), a surname (including a l ...
, called the ''car'' and ''cdr''. These are respectively equivalent to the and fields discussed in the article ''
linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whic ...
''. Of the many data structures that can be built out of cons cells, one of the most basic is called a ''proper list''. A proper list is either the special (empty list) symbol, or a cons in which the points to a datum (which may be another cons structure, such as a list), and the points to another proper list. If a given cons is taken to be the head of a linked list, then its car points to the first element of the list, and its cdr points to the rest of the list. For this reason, the and functions are also called and when referring to conses which are part of a linked list (rather than, say, a tree). Thus, a Lisp list is not an atomic object, as an instance of a container class in C++ or Java would be. A list is nothing more than an aggregate of linked conses. A variable that refers to a given list is simply a pointer to the first cons in the list. Traversal of a list can be done by ''cdring down'' the list; that is, taking successive cdrs to visit each cons of the list; or by using any of several
higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s to map a function over a list. Because conses and lists are so universal in Lisp systems, it is a common misconception that they are Lisp's only data structures. In fact, all but the most simplistic Lisps have other data structures, such as vectors (
arrays An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
),
hash table In computing, a hash table, also known as hash map, is a data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an ''index'', als ...
s, structures, and so forth.


S-expressions represent lists

Parenthesized S-expressions represent linked list structures. There are several ways to represent the same list as an S-expression. A cons can be written in ''dotted-pair notation'' as , where is the car and the cdr. A longer proper list might be written in dotted-pair notation. This is conventionally abbreviated as in ''list notation''. An improper listNB: a so-called "dotted list" is only one kind of "improper list". The other kind is the "circular list" where the cons cells form a loop. Typically this is represented using #n=(...) to represent the target cons cell that will have multiple references, and #n# is used to refer to this cons. For instance, (#1=(a b) . #1#) would normally be printed as ((a b) a b) (without circular structure printing enabled), but makes the reuse of the cons cell clear. #1=(a . #1#) cannot normally be printed as it is circular, although (a...) is sometimes displayed, the CDR of the cons cell defined by #1= is itself. may be written in a combination of the two – as for the list of three conses whose last cdr is (i.e., the list in fully specified form).


List-processing procedures

Lisp provides many built-in procedures for accessing and controlling lists. Lists can be created directly with the procedure, which takes any number of arguments, and returns the list of these arguments. (list 1 2 'a 3) ;Output: (1 2 a 3) (list 1 '(2 3) 4) ;Output: (1 (2 3) 4) Because of the way that lists are constructed from cons pairs, the procedure can be used to add an element to the front of a list. Note that the procedure is asymmetric in how it handles list arguments, because of how lists are constructed. (cons 1 '(2 3)) ;Output: (1 2 3) (cons '(1 2) '(3 4)) ;Output: ((1 2) 3 4) The procedure appends two (or more) lists to one another. Because Lisp lists are linked lists, appending two lists has asymptotic time complexity O(n) (append '(1 2) '(3 4)) ;Output: (1 2 3 4) (append '(1 2 3) '() '(a) '(5 6)) ;Output: (1 2 3 a 5 6)


Shared structure

Lisp lists, being simple linked lists, can share structure with one another. That is to say, two lists can have the same ''tail'', or final sequence of conses. For instance, after the execution of the following Common Lisp code: (setf foo (list 'a 'b 'c)) (setf bar (cons 'x (cdr foo))) the lists and are and respectively. However, the tail is the same structure in both lists. It is not a copy; the cons cells pointing to and are in the same memory locations for both lists. Sharing structure rather than copying can give a dramatic performance improvement. However, this technique can interact in undesired ways with functions that alter lists passed to them as arguments. Altering one list, such as by replacing the with a , will affect the other: (setf (third foo) 'goose) This changes to , but thereby also changes to – a possibly unexpected result. This can be a source of bugs, and functions which alter their arguments are documented as ''destructive'' for this very reason. Aficionados of
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declar ...
avoid destructive functions. In the Scheme dialect, which favors the functional style, the names of destructive functions are marked with a cautionary exclamation point, or "bang"—such as (read ''set car bang''), which replaces the car of a cons. In the Common Lisp dialect, destructive functions are commonplace; the equivalent of is named for "replace car". This function is rarely seen, however, as Common Lisp includes a special facility, , to make it easier to define and use destructive functions. A frequent style in Common Lisp is to write code functionally (without destructive calls) when prototyping, then to add destructive calls as an optimization where it is safe to do so.


Self-evaluating forms and quoting

Lisp evaluates expressions which are entered by the user. Symbols and lists evaluate to some other (usually, simpler) expression – for instance, a symbol evaluates to the value of the variable it names; evaluates to . However, most other forms evaluate to themselves: if entering into Lisp, it returns . Any expression can also be marked to prevent it from being evaluated (as is necessary for symbols and lists). This is the role of the special operator, or its abbreviation (one quotation mark). For instance, usually if entering the symbol , it returns the value of the corresponding variable (or an error, if there is no such variable). To refer to the literal symbol, enter or, usually, . Both Common Lisp and Scheme also support the ''backquote'' operator (termed ''
quasiquote Quasi-quotation or Quine quotation is a linguistic device in formal languages that facilitates rigorous and terse formulation of general rules about linguistic expressions while properly observing the use–mention distinction. It was introduced ...
'' in Scheme), entered with the character (
grave accent The grave accent () ( or ) is a diacritical mark used to varying degrees in French, Dutch, Portuguese, Italian and many other western European languages, as well as for a few unusual uses in English. It is also used in other languages using t ...
). This is almost the same as the plain quote, except it allows expressions to be evaluated and their values interpolated into a quoted list with the comma ''unquote'' and comma-at ''splice'' operators. If the variable has the value then evaluates to , while evaluates to . The backquote is most often used in defining macro expansions.Quasiquotation in Lisp
, Alan Bawden
Self-evaluating forms and quoted forms are Lisp's equivalent of literals. It may be possible to modify the values of (mutable) literals in program code. For instance, if a function returns a quoted form, and the code that calls the function modifies the form, this may alter the behavior of the function on subsequent invocations. (defun should-be-constant () '(one two three)) (let ((stuff (should-be-constant))) (setf (third stuff) 'bizarre)) ; bad! (should-be-constant) ; returns (one two bizarre) Modifying a quoted form like this is generally considered bad style, and is defined by ANSI Common Lisp as erroneous (resulting in "undefined" behavior in compiled files, because the file-compiler can coalesce similar constants, put them in write-protected memory, etc.). Lisp's formalization of quotation has been noted by
Douglas Hofstadter Douglas Richard Hofstadter (born February 15, 1945) is an American scholar of cognitive science, physics, and comparative literature whose research includes concepts such as the sense of self in relation to the external world, consciousness, an ...
(in ''
Gödel, Escher, Bach ''Gödel, Escher, Bach: an Eternal Golden Braid'', also known as ''GEB'', is a 1979 book by Douglas Hofstadter. By exploring common themes in the lives and works of logician Kurt Gödel, artist M. C. Escher, and composer Johann Sebastian Bach, t ...
'') and others as an example of the
philosophical Philosophy (from , ) is the systematized study of general and fundamental questions, such as those about existence, reason, knowledge, values, mind, and language. Such questions are often posed as problems to be studied or resolved. Some ...
idea of
self-reference Self-reference occurs in natural or formal languages when a sentence, idea or formula refers to itself. The reference may be expressed either directly—through some intermediate sentence or formula—or by means of some encoding. In philoso ...
.


Scope and closure

The Lisp family splits over the use of
dynamic Dynamics (from Greek δυναμικός ''dynamikos'' "powerful", from δύναμις ''dynamis'' "power") or dynamic may refer to: Physics and engineering * Dynamics (mechanics) ** Aerodynamics, the study of the motion of air ** Analytical dynam ...
or
static Static may refer to: Places *Static Nunatak, a nunatak in Antarctica United States * Static, Kentucky and Tennessee *Static Peak, a mountain in Wyoming **Static Peak Divide, a mountain pass near the peak Science and technology Physics *Static el ...
(a.k.a. lexical)
scope Scope or scopes may refer to: People with the surname * Jamie Scope (born 1986), English footballer * John T. Scopes (1900–1970), central figure in the Scopes Trial regarding the teaching of evolution Arts, media, and entertainment * Cinem ...
. Clojure, Common Lisp and Scheme make use of static scoping by default, while
newLISP newLISP is a scripting language which is a dialect of the Lisp family of programming languages. It was designed and developed by Lutz Mueller. newLISP is free and open-source software released under the GNU General Public License, version 3 or ...
,
Picolisp PicoLisp is a programming language, a dialect of the language Lisp. It runs on operating systems including Linux and others that are ''Portable Operating System Interface'' (POSIX) compliant. Its most prominent features are simplicity and minimali ...
and the embedded languages in
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
and
AutoCAD AutoCAD is a commercial computer-aided design (CAD) and drafting software application. Developed and marketed by Autodesk, AutoCAD was first released in December 1982 as a desktop app running on microcomputers with internal graphics controllers. ...
use dynamic scoping. Since version 24.1, Emacs uses both dynamic and lexical scoping.


List structure of program code; exploitation by macros and compilers

A fundamental distinction between Lisp and other languages is that in Lisp, the textual representation of a program is simply a human-readable description of the same internal data structures (linked lists, symbols, number, characters, etc.) as would be used by the underlying Lisp system. Lisp uses this to implement a very powerful macro system. Like other macro languages such as the one defined by the
C preprocessor The C preprocessor is the macro preprocessor for the C, Objective-C and C++ computer programming languages. The preprocessor provides the ability for the inclusion of header files, macro expansions, conditional compilation, and line control ...
(the macro preprocessor for the C,
Objective-C Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTS ...
and
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
programming languages), a macro returns code that can then be compiled. However, unlike C preprocessor macros, the macros are Lisp functions and so can exploit the full power of Lisp. Further, because Lisp code has the same structure as lists, macros can be built with any of the list-processing functions in the language. In short, anything that Lisp can do to a data structure, Lisp macros can do to code. In contrast, in most other languages, the parser's output is purely internal to the language implementation and cannot be manipulated by the programmer. This feature makes it easy to develop ''efficient'' languages within languages. For example, the Common Lisp Object System can be implemented cleanly as a language extension using macros. This means that if an application needs a different inheritance mechanism, it can use a different object system. This is in stark contrast to most other languages; for example, Java does not support multiple inheritance and there is no reasonable way to add it. In simplistic Lisp implementations, this list structure is directly interpreted to run the program; a function is literally a piece of list structure which is traversed by the interpreter in executing it. However, most substantial Lisp systems also include a compiler. The compiler translates list structure into machine code or
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
for execution. This code can run as fast as code compiled in conventional languages such as C. Macros expand before the compilation step, and thus offer some interesting options. If a program needs a precomputed table, then a macro might create the table at compile time, so the compiler need only output the table and need not call code to create the table at run time. Some Lisp implementations even have a mechanism, eval-when, that allows code to be present during compile time (when a macro would need it), but not present in the emitted module.Time of Evaluation - Common Lisp Extensions
Gnu.org. Retrieved on 2013-07-17.


Evaluation and the read–eval–print loop

Lisp languages are often used with an interactive
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
, which may be combined with an
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
(IDE). The user types in expressions at the command line, or directs the IDE to transmit them to the Lisp system. Lisp ''reads'' the entered expressions, ''evaluates'' them, and ''prints'' the result. For this reason, the Lisp command line is called a ''
read–eval–print loop A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written ...
'' ( REPL). The basic operation of the REPL is as follows. This is a simplistic description which omits many elements of a real Lisp, such as quoting and macros. The function accepts textual S-expressions as input, and parses them into an internal data structure. For instance, if you type the text at the prompt, translates this into a linked list with three elements: the symbol , the number 1, and the number 2. It so happens that this list is also a valid piece of Lisp code; that is, it can be evaluated. This is because the car of the list names a function—the addition operation. Note that a will be read as a single symbol. will be read as the number one hundred and twenty-three. will be read as the string "123". The function evaluates the data, returning zero or more other Lisp data as a result. Evaluation does not have to mean interpretation; some Lisp systems compile every expression to native machine code. It is simple, however, to describe evaluation as interpretation: To evaluate a list whose car names a function, first evaluates each of the arguments given in its cdr, then applies the function to the arguments. In this case, the function is addition, and applying it to the argument list yields the answer . This is the result of the evaluation. The symbol evaluates to the value of the symbol foo. Data like the string "123" evaluates to the same string. The list evaluates to the list (1 2 3). It is the job of the function to represent output to the user. For a simple result such as this is trivial. An expression which evaluated to a piece of list structure would require that traverse the list and print it out as an S-expression. To implement a Lisp REPL, it is necessary only to implement these three functions and an infinite-loop function. (Naturally, the implementation of will be complex, since it must also implement all special operators like or .) This done, a basic REPL is one line of code: . The Lisp REPL typically also provides input editing, an input history, error handling and an interface to the debugger. Lisp is usually evaluated eagerly. In
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
, arguments are evaluated in
applicative order In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the f ...
('leftmost innermost'), while in
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
order of arguments is undefined, leaving room for optimization by a compiler.


Control structures

Lisp originally had very few control structures, but many more were added during the language's evolution. (Lisp's original conditional operator, , is the precursor to later structures.) Programmers in the Scheme dialect often express loops using
tail recursion In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recur ...
. Scheme's commonality in academic computer science has led some students to believe that tail recursion is the only, or the most common, way to write iterations in Lisp, but this is incorrect. All oft-seen Lisp dialects have imperative-style iteration constructs, from Scheme's loop to
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
's complex expressions. Moreover, the key issue that makes this an objective rather than subjective matter is that Scheme makes specific requirements for the handling of
tail call In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recur ...
s, and thus the reason that the use of tail recursion is generally encouraged for Scheme is that the practice is expressly supported by the language definition. By contrast, ANSI Common Lisp does not require3.2.2.3 Semantic Constraints
i

/ref> the optimization commonly termed a tail call elimination. Thus, the fact that tail recursive style as a casual replacement for the use of more traditional
iteration Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration. ...
constructs (such as , or ) is discouraged4.3. Control Abstraction (Recursion vs. Iteration) i
Tutorial on Good Lisp Programming Style
by
Kent Pitman Kent M. Pitman (KMP) is a programmer who has been involved for many years in the design, implementation, and use of systems based on the programming languages Lisp and Scheme. , he has been President of HyperMeta, Inc. Pitman was chair of the ad h ...
and
Peter Norvig Peter Norvig (born December 14, 1956) is an American computer scientist and Distinguished Education Fellow at the Stanford Institute for Human-Centered AI. He previously served as a director of research and search quality at Google. Norvig is t ...
, August, 1993.
in Common Lisp is not just a matter of stylistic preference, but potentially one of efficiency (since an apparent tail call in Common Lisp may not compile as a simple
jump Jumping is a form of locomotion or movement in which an organism or non-living (e.g., robotic) mechanical system propels itself through the air along a ballistic trajectory. Jump or Jumping also may refer to: Places * Jump, Kentucky or Jump St ...
) and program correctness (since tail recursion may increase stack use in Common Lisp, risking
stack overflow In software, a stack overflow occurs if the call stack pointer exceeds the stack bound. The call stack may consist of a limited amount of address space, often determined at the start of the program. The size of the call stack depends on many fac ...
). Some Lisp control structures are ''special operators'', equivalent to other languages' syntactic keywords. Expressions using these operators have the same surface appearance as function calls, but differ in that the arguments are not necessarily evaluated—or, in the case of an iteration expression, may be evaluated more than once. In contrast to most other major programming languages, Lisp allows implementing control structures using the language. Several control structures are implemented as Lisp macros, and can even be macro-expanded by the programmer who wants to know how they work. Both Common Lisp and Scheme have operators for non-local control flow. The differences in these operators are some of the deepest differences between the two dialects. Scheme supports ''re-entrant
continuation In computer science, a continuation is an abstract representation of the control state of a computer program. A continuation implements ( reifies) the program control state, i.e. the continuation is a data structure that represents the computati ...
s'' using the procedure, which allows a program to save (and later restore) a particular place in execution. Common Lisp does not support re-entrant continuations, but does support several ways of handling escape continuations. Often, the same algorithm can be expressed in Lisp in either an imperative or a functional style. As noted above, Scheme tends to favor the functional style, using tail recursion and continuations to express control flow. However, imperative style is still quite possible. The style preferred by many Common Lisp programmers may seem more familiar to programmers used to structured languages such as C, while that preferred by Schemers more closely resembles pure-functional languages such as
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
. Because of Lisp's early heritage in list processing, it has a wide array of higher-order functions relating to iteration over sequences. In many cases where an explicit loop would be needed in other languages (like a loop in C) in Lisp the same task can be accomplished with a higher-order function. (The same is true of many functional programming languages.) A good example is a function which in Scheme is called and in Common Lisp is called . Given a function and one or more lists, applies the function successively to the lists' elements in order, collecting the results in a new list: (mapcar #'+ '(1 2 3 4 5) '(10 20 30 40 50)) This applies the function to each corresponding pair of list elements, yielding the result .


Examples

Here are examples of Common Lisp code. The basic " Hello, World!" program: (print "Hello, World!") Lisp syntax lends itself naturally to recursion. Mathematical problems such as the enumeration of recursively defined sets are simple to express in this notation. For example, to evaluate a number's
factorial In mathematics, the factorial of a non-negative denoted is the product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial: \begin n! &= n \times (n-1) \times (n-2) \t ...
: (defun factorial (n) (if (zerop n) 1 (* n (factorial (1- n))))) An alternative implementation takes less stack space than the previous version if the underlying Lisp system optimizes
tail recursion In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recur ...
: (defun factorial (n &optional (acc 1)) (if (zerop n) acc (factorial (1- n) (* acc n)))) Contrast the examples above with an iterative version which uses
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
's macro: (defun factorial (n) (loop for i from 1 to n for fac = 1 then (* fac i) finally (return fac))) The following function reverses a list. (Lisp's built-in ''reverse'' function does the same thing.) (defun -reverse (list) (let ((return-value)) (dolist (e list) (push e return-value)) return-value))


Object systems

Various object systems and models have been built on top of, alongside, or into Lisp, including: * The
Common Lisp Object System The Common Lisp Object System (CLOS) is the facility for object-oriented programming which is part of ANSI Common Lisp. CLOS is a powerful dynamic object system which differs radically from the OOP facilities found in more static languages such as ...
, CLOS, is an integral part of ANSI Common Lisp. CLOS descended from New Flavors and CommonLOOPS. ANSI Common Lisp was the first standardized object-oriented programming language (1994, ANSI X3J13). * ObjectLisppg 17 of Bobrow 1986 or
Object Lisp Object Lisp was a computer programming language, a dialect of the Lisp language. It was an object-oriented extension for the Lisp dialect Lisp Machine Lisp, designed by Lisp Machines, Inc. Object Lisp was also an early example of prototype-based pro ...
, used by
Lisp Machines Incorporated Lisp machines are general-purpose computers designed to efficiently run Lisp as their main software and programming language, usually via hardware support. They are an example of a high-level language computer architecture, and in a sense, the ...
and early versions of Macintosh Common Lisp * LOOPS (Lisp Object-Oriented Programming System) and the later
CommonLoops CommonLoops (the Common Lisp Object-Oriented Programming System; an acronym reminiscent of the earlier Lisp OO system "Loops" for the Interlisp-D system) is an early programming language which extended Common Lisp to include Object-oriented progra ...
*
Flavors Flavor or flavour is either the sensory perception of taste or smell, or a flavoring in food that produces such perception. Flavor or flavour may also refer to: Science *Flavors (programming language), an early object-oriented extension to Lis ...
, built at
MIT The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of the mo ...
, and its descendant New Flavors (developed by
Symbolics Symbolics was a computer manufacturer Symbolics, Inc., and a privately held company that acquired the assets of the former company and continues to sell and maintain the Open Genera Lisp system and the Macsyma computer algebra system.
). * KR (short for Knowledge Representation), a constraints-based object system developed to aid the writing of Garnet, a GUI library for
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
. *
Knowledge Engineering Environment Knowledge Engineering Environment (KEE) is a Frame language, frame-based development tool for expert systems. It was developed and sold by IntelliCorp (software), IntelliCorp, and first released in 1983. It ran on Lisp machines, and was later port ...
(KEE) used an object system named UNITS and integrated it with an
inference engine In the field of artificial intelligence, an inference engine is a component of the system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems. The typical expert ...
Veitch, p 108, 1988 and a truth maintenance system (ATMS).


Operating systems

Several
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s, including
language-based system A language-based system is a type of operating system that uses language features to provide security, instead of or in addition to hardware mechanisms. In such systems, code referred to as the ''trusted base'' is responsible for approving programs ...
s, are based on Lisp (use Lisp features, conventions, methods, data structures, etc.), or are written in Lisp, including:
Genera Genus ( plural genera ) is a taxonomic rank used in the biological classification of living and fossil organisms as well as viruses. In the hierarchy of biological classification, genus comes above species and below family. In binomial nomenclat ...
, renamed Open Genera, by
Symbolics Symbolics was a computer manufacturer Symbolics, Inc., and a privately held company that acquired the assets of the former company and continues to sell and maintain the Open Genera Lisp system and the Macsyma computer algebra system.
; Medley, written in Interlisp, originally a family of graphical operating systems that ran on
Xerox Xerox Holdings Corporation (; also known simply as Xerox) is an American corporation that sells print and electronic document, digital document products and services in more than 160 countries. Xerox is headquartered in Norwalk, Connecticut (ha ...
's later
Star A star is an astronomical object comprising a luminous spheroid of plasma (physics), plasma held together by its gravity. The List of nearest stars and brown dwarfs, nearest star to Earth is the Sun. Many other stars are visible to the naked ...
workstation A workstation is a special computer designed for technical or scientific applications. Intended primarily to be used by a single user, they are commonly connected to a local area network and run multi-user operating systems. The term ''workstat ...
s; Mezzano; Interim; ChrysaLisp, by developers of Tao Systems' TAOS.


See also

*
Self-modifying code In computer science, self-modifying code (SMC) is code that alters its own instructions while it is executing – usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, ...


References


Further reading

* * * *
My Lisp Experiences and the Development of GNU Emacs
transcript of
Richard Stallman Richard Matthew Stallman (; born March 16, 1953), also known by his initials, rms, is an American free software movement activist and programmer. He campaigns for software to be distributed in such a manner that its users have the freedom to ...
's speech, 28 October 2002, at the International Lisp Conference * * ** Article largely based on the ''LISP - A Simple Introduction'' chapter: *


External links

;History
History of Lisp
John McCarthy's history of 12 February 1979
Lisp History
– Herbert Stoyan's history compiled from the documents (acknowledged by McCarthy as more complete than his own, see
McCarthy's history links

History of LISP at the Computer History Museum
* about the use of LISP software on NASA robots. * ;Associations and meetings
Association of Lisp Users

European Common Lisp Meeting

European Lisp Symposium

International Lisp Conference
;Books and tutorials *

', a comic-book style introductory tutorial *

', a free book by Paul Graham *
Practical Common Lisp
', freeware edition by Peter Seibel
Lisp for the web

Land of Lisp

Let over Lambda
;Interviews
Oral history interview with John McCarthy
at
Charles Babbage Institute The IT History Society (ITHS) is an organization that supports the history and scholarship of information technology by encouraging, fostering, and facilitating archival and historical research. Formerly known as the Charles Babbage Foundation, ...
, University of Minnesota, Minneapolis. McCarthy discusses his role in the development of time-sharing at the Massachusetts Institute of Technology. He also describes his work in artificial intelligence (AI) funded by the Advanced Research Projects Agency, including logic-based AI (LISP) and robotics.
Interview
with
Richard P. Gabriel Richard P. Gabriel (born 1949) is an American computer scientist known for his work in computing related to the programming language Lisp, and especially Common Lisp. His best known work was a 1990 essay "Lisp: Good News, Bad News, How to Win Bi ...
(Podcast) ;Resources
CLiki: the Common Lisp wiki

The Common Lisp Directory
(via the
Wayback Machine The Wayback Machine is a digital archive of the World Wide Web founded by the Internet Archive, a nonprofit based in San Francisco, California. Created in 1996 and launched to the public in 2001, it allows the user to go "back in time" and see ...
; archived fro
the original

Lisp FAQ Index

lisppaste

Planet Lisp

Weekly Lisp News

newLISP - A modern, general-purpose scripting language

Lisp Weekly
* {{DEFAULTSORT:Lisp Programming Language Academic programming languages American inventions Articles with example Lisp (programming language) code Dynamically typed programming languages Extensible syntax programming languages Functional languages Programming languages Programming languages created in 1958