A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier.... programming language
Programming language
A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer.... s with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language
High-level programming language
In computing, a high-level programming language is a programming language with strong Abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or more Porting across platforms.... in widespread use today; only Fortran
Fortran
Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing.... is older. Like Fortran, Lisp has changed a great deal since its early days, and a number of dialects
Programming language dialect
A dialect of a programming language is a variation or extension of the language that does not change its intrinsic nature. With languages such as Scheme and Forth , standards may be considered insufficient, inadequate or even illegitimate by implementors, so often they will deviate from the standard, making a new dialect.... have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... and Scheme.
Lisp was originally created as a practical mathematical notation for computer programs, based on Alonzo Church
Alonzo Church
Alonzo Church was an United States mathematician and list of logicians who made major contributions to mathematical logic and the foundations of theoretical computer science.... 's lambda calculus
Lambda calculus
In mathematical logic and computer science, lambda calculus, also written as ?-calculus, is a formal system designed to investigate function definition, function application and recursion.... .
Discussion
Ask a question about 'Lisp programming language'
Start a new discussion about 'Lisp programming language'
Answer questions from other users
Full Discussion Forum
Quotations
Common Lisp is politics, not art. — Scott Fahlman
Emacs is written in Lisp, which is the only computer language that is beautiful. — Neal Stephenson, In the Beginning was
the Command Line
If you want to know why Lisp doesn't win around you, find a mirror. — Erik Naggum
Just because we Lisp programmers are better than everyone else is no excuse for us to be arrogant. — Erann Gat
Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in. — Larry Wall
LISP has survived for 21 years because it is an approximate local optimum in the space of programming languages. — John McCarthy (1980)
A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier.... programming language
Programming language
A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer.... s with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language
High-level programming language
In computing, a high-level programming language is a programming language with strong Abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or more Porting across platforms.... in widespread use today; only Fortran
Fortran
Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing.... is older. Like Fortran, Lisp has changed a great deal since its early days, and a number of dialects
Programming language dialect
A dialect of a programming language is a variation or extension of the language that does not change its intrinsic nature. With languages such as Scheme and Forth , standards may be considered insufficient, inadequate or even illegitimate by implementors, so often they will deviate from the standard, making a new dialect.... have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... and Scheme.
Lisp was originally created as a practical mathematical notation for computer programs, based on Alonzo Church
Alonzo Church
Alonzo Church was an United States mathematician and list of logicians who made major contributions to mathematical logic and the foundations of theoretical computer science.... 's lambda calculus
Lambda calculus
In mathematical logic and computer science, lambda calculus, also written as ?-calculus, is a formal system designed to investigate function definition, function application and recursion.... . It quickly became the favored programming language for artificial intelligence
Artificial intelligence
Artificial intelligence is the intelligence of machines and the branch of computer science which aims to create it. Major AI textbooks define the field as "the study and design of intelligent agents,"... (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in computer science
Computer science
Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems.... , including tree data structures, automatic storage management
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage , or memory used by Object that will never be accessed or mutated again by the Application software.... , dynamic typing, object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm that uses "Object_" and their interactions to design applications and computer programs.... , and the self-hosting
Self-hosting
The term self-hosting was coined to refer to the use of a computer 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.... compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program.... .
The name LISP derives from "LISt Processing language". Linked list
Linked list
In computer science, a linked list is one of the fundamental data structures, and can be used to implement other data structures. It consists of a sequence of node s, each containing arbitrary data Field s and one or two reference s pointing to the next and/or previous nodes.... s are one of Lisp languages' major data structure
Data structure
A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data.... s, and Lisp source code
Source code
In computer science, source code is any collection of statements or declarations written in some human-readable computer programming language.... is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or even new domain-specific programming language
Domain-specific programming language
In software development, a domain-specific language is a programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique.... s embedded in Lisp.
The interchangeability of code and data also gives Lisp its instantly recognizable syntax. All program code is written as s-expression
S-expression
The term S-expression or sexp refers to a convention for representing semi-structured data in human-readable textual form. S-expressions are probably best known for their use in the Lisp programming language family of programming languages.... 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 f that takes three arguments might be called using (f x y z).
John McCarthy , is an United States computer scientist and cognitive scientist who received the Turing Award in 1971 for his major contributions to the field of Artificial Intelligence .... in 1958 while he was at the Massachusetts Institute of Technology
Massachusetts Institute of Technology
The Massachusetts Institute of Technology is a private university research university located in Cambridge, Massachusetts, Massachusetts, United States.... (MIT). McCarthy published its design in a paper in Communications of the ACM
Communications of the ACM
Communications of the ACM is the flagship monthly journal of the Association for Computing Machinery . First published in 1957, CACM is sent to all ACM members, currently numbering about 80,000.... in 1960, entitled "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I" ("Part II" was never published). He showed that with a few simple operators and a notation for functions, one can build a Turing-complete language for algorithms.
Information Processing Language is a programming language developed by Allen Newell, Cliff Shaw, and Herbert Simon at RAND Corporation and the Carnegie Institute of Technology from about 1956.... 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
M-expression
In computer programming, M-expressions were intended to be the expressions used to write functions in the Lisp . Data to be manipulated using M-expressions was to be written using S-expressions.... s" that would be translated into S-expression
S-expression
The term S-expression or sexp refers to a convention for representing semi-structured data in human-readable textual form. S-expressions are probably best known for their use in the Lisp programming language family of programming languages.... s. As an example, the M-expression car[cons[A,B]] is equivalent to the S-expression (car (cons A B)). 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
MLISP is a variant of Lisp programming language with an ALGOL-like syntax based on M-expression, which were the function syntax in the original description of Lisp by John McCarthy .... by Horace Enea and CGOL
CGOL
CGOL is an alternative syntax for the MACLISP programming language,featuring an extensible algebraic notation. It was created by Vaughan Ronald Pratt.... by Vaughan Pratt.
Steve "Slug" Russell is a programmer and computer scientist most famous for creating Spacewar!, one of the earliest videogames, in 1961 with the fellow members of the Tech Model Railroad Club at MIT working on a Digital Equipment Corporation Digital PDP-1.... on an IBM 704
IBM 704
The IBM 704, the first mass-produced computer with floating point arithmetic hardware, was introduced by IBM in April, 1954. The 704 was significantly improved over the IBM 701 in terms of architecture as well as implementation, and was not compatible with its predecessor.... computer. Russell had read McCarthy's paper, and realized (to McCarthy's surprise) that the Lisp eval function could be implemented in machine code. The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly, 'evaluate Lisp expressions.'
The IBM 704, the first mass-produced computer with floating point arithmetic hardware, was introduced by IBM in April, 1954. The 704 was significantly improved over the IBM 701 in terms of architecture as well as implementation, and was not compatible with its predecessor.... became the primitive operations for decomposing lists: car
Car and cdr
Introduced in the Lisp programming language, car and cdr are primitive operations upon linked lists composed of cons cells. A cons cell is composed of two pointers; the car operation extracts the first pointer, and the cdr operation extracts the second.... (Contents of Address Register) and cdr
Car and cdr
Introduced in the Lisp programming language, car and cdr are primitive operations upon linked lists composed of cons cells. A cons cell is composed of two pointers; the car operation extracts the first pointer, and the cdr operation extracts the second.... (Contents of Decrement Register). Lisp dialects still use car and cdr ( 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. This compiler introduced the Lisp model of incremental compilation, 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.
Genealogy and variants
Over its fifty-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
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... .
Differences between dialects may be quite visible—for instance, Common Lisp and Scheme use different keywords to define functions. 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.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
LISP 2 was a programming language proposed in the 1960s as the successor to Lisp . It had largely Lisp-like semantics and ALGOL-like syntax. Today it is mostly remembered for its syntax, but in fact it had many features beyond those of early Lisps.... would be.
Stanford LISP 1.6 – This was a successor to LISP 1.5 developed at the Stanford AI Lab, and widely distributed to PDP-10
PDP-10
The PDP-10 was a mainframe computer manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10".... systems running the TOPS-10
TOPS-10
The TOPS-10 System was a computer operating system from Digital Equipment Corporation for the PDP-10 mainframe computer launched in 1967. TOPS-10 evolved from the earlier "Monitor" software for the PDP-6 and -10 computers; this was renamed TOPS-10 in 1970.... operating system. It was rendered obsolete by Maclisp and InterLisp.
MACLISP is a dialect of the Lisp programming language programming language. It originated at Massachusetts Institute of Technology's Project MAC in the late 1960s and was based on Lisp 1.5.... – developed for MIT's Project MAC (no relation to Apple's Macintosh
Macintosh
File:Imac alu.pngMacintosh, commonly shortened to Mac, is a brand name which covers several lines of personal computers designed, developed, and marketed by Apple Inc.... , nor to McCarthy
John McCarthy (computer scientist)
John McCarthy , is an United States computer scientist and cognitive scientist who received the Turing Award in 1971 for his major contributions to the field of Artificial Intelligence .... ), direct descendant of LISP 1.5. It ran on the PDP-10 and Multics
Multics
Multics was an extremely influential early time-sharing operating system. The project was started in 1964. The last known running Multics installation was shut down on October 30, 2000.... systems. (MACLISP would later come to be called Maclisp, and is often referred to as MacLisp.)
Interlisp was a programming environment built around a version of the Lisp programming language. Interlisp development began in 1967 at Bolt, Beranek and Newman in Cambridge, Massachusetts as BBN LISP, which ran on PDP-10 machines running the TENEX operating system.... – developed at BBN Technologies
BBN Technologies
BBN Technologies is a high-technology company which provides research and development services. BBN is based next to Fresh Pond, Cambridge, Massachusetts in Cambridge, Massachusetts, Massachusetts, United States.... for PDP-10 systems running the Tenex
TOPS-20
The TOPS-20 operating system by Digital Equipment Corporation was the second proprietary OS for the PDP-10 mainframe computer. TOPS-20 began in 1969 as Bolt, Beranek and Newman's TENEX operating system, using special paging hardware.... 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 Atari
Atari
Atari is a corporate and brand name owned by several entities since its inception in 1972. It is currently owned by Atari Interactive, a wholly owned subsidiary of the French publisher Infogrames .... 's 6502
MOS Technology 6502
The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured central processing unit on the market by a considerable margin, costing less than one-sixth the price of competing designs from larger companies such... -based computer line. For quite some time Maclisp and InterLisp were strong competitors.
Franz Lisp, written at UC Berkeley by the students of Professor Richard Fateman, was a Lisp programming language system based largely on Maclisp, but written specifically to be a host for running the Macsyma Computer algebra on a VAX.... – originally a Berkeley
University of California, Berkeley
The University of California, Berkeley is a public university research university located in Berkeley, California, California, United States. The oldest of the ten major campuses affiliated with the University of California, Berkeley offers some 300 undergraduate and graduate degree programs in a wide range of disciplines.... project; later developed by Franz Inc. The name is a humorous deformation of "Franz Liszt
Franz Liszt
Franz Liszt was a Kingdom of Hungary composer, virtuoso pianist and teacher.Liszt became renowned throughout Europe for his great skill as a performer during the 19th century.... ". The name "Franz Lisp" does not refer to Allegro Common Lisp
Allegro Common Lisp
Allegro Common Lisp is a commercial implementation of the Common Lisp programming language developed by Franz Inc. Allegro CL provides the full ANSI Common Lisp standard with many extensions.... , the dialect of Common Lisp sold by Franz Inc. in more recent years.
XLISP is a family of Lisp programming language implementations written by David Betz.The first version was a Lisp with object-oriented extensions for computers with limited power.... , which AutoLisp
AutoLISP
AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include Autodesk Map 3D and Autodesk Architectural Desktop.... was based on.
Portable Standard Lisp is a tail-recursion dynamic binding dialect of Lisp programming language inspired by its predecessor, Standard Lisp and the Portable Lisp Compiler.... were widely used and ported, especially with the Computer Algebra System REDUCE.
ZetaLisp was the name Symbolics gave to their dialect of Lisp programming language on their Lisp Machine models, to distinguish it from the MIT version, which was called Lisp Machine Lisp.... , also known as Lisp Machine Lisp – used on the Lisp machine
Lisp machine
Lisp machines were general-purpose computers designed to efficiently run Lisp programming language as their main programming language. In a sense, they were the first commercial single-user Computer workstation.... s, direct descendant of Maclisp. ZetaLisp had big influence on Common Lisp.
LeLisp is a French Lisp dialect. One of the first Interface Builders was written in LeLisp.
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... , as described by Common Lisp: The Language
Common Lisp the Language
Common Lisp the Language is a book by Guy L. Steele about Common Lisp.The first edition served as the basis for the ANSI Common Lisp standard.... – a consolidation of several divergent attempts (ZetaLisp, Spice Lisp
Spice Lisp
Spice Lisp is a Lisp programming language dialect and its implementation originally written by Carnegie Mellon University's Spice Lisp Group which targeted the microcode of the 16-bit PERQ workstation and its Accent operating system; it used that workstation's microcode abilities to implement a stack architecture to store its data structures... , NIL
NIL (programming language)
NIL was a 32-bit implementation of Lisp developed at Massachusetts Institute of Technology and intended to be the successor to Maclisp. NIL stood for "New Implementation of LISP", and was in part a response to Digital Equipment Corporation VAX computer.... , and S-1 Lisp
S-1 Lisp
S-1 Lisp was an Lisp programming language implementation written in Lisp for the 36-bit Pipeline S-1 Mark IIA supercomputer computer architecture, which has 32 megawords of RAM.... ) 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
De facto standard
A de facto standard is a custom, convention, product, or system that has achieved a dominant position by public acceptance or market forces . De facto is a Latin phrase meaning "concerning the fact" or "in practice", and is used in opposition to de jure .... until the publication of ANSI Common Lisp (ANSI X3.226-1994).
Dylan was in its first version a mix of Scheme with the Common Lisp Object System.
EuLisp is a Scope and Scope Lisp programming language dialect, developed, as name suggests, in Europe. The Standardization intended to create a new Lisp "less encumbered by the past" , and not so Computing minimalism as Scheme .... – attempt to develop a new efficient and cleaned-up Lisp.
ISLISP is a programming language in the Lisp programming language family standardized by the ISO. The goal of the ISO standardization effort was to define a small, core language to help bridge the gap between differing dialects of Lisp.... – attempt to develop a new efficient and cleaned-up Lisp. Standardized as and later revised as - Information technology – Programming languages, their environments and system software interfaces – Programming language ISLISP.
The American National Standards Institute or 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.... (ANSI) standard
Standardization
Standardization is the process of developing and agreeing upon Standard . A standard is a document that establishes uniform engineering or technical specifications, criteria, methods, processes, or practices.... for Common Lisp, created by subcommittee X3J13
X3J13
X3J13 is the name of a technical committee which was part of INCITS . The X3J13 committee was formed in 1986 to draw up an ANSI Common Lisp standard based on the first edition of the book Common Lisp the Language , which was previously a de facto standard for the language.... , chartered to begin with Common Lisp: The Language as a base document and to work through a public consensus
Consensus decision-making
Consensus decision-making is a group decision making process that not only seeks the agreement of most participants, but also the resolution or mitigation of minority objections.... process to find solutions to shared issues of portability of programs and compatibility
Computer compatibility
A family of computer models is said to be compatible if certain software that runs on one of the models can also be run on all other models of the family.... 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 world-wide.
ACL2 or "A Computational Logic for Applicative Common Lisp", an applicative (side-effect free) variant of Common LISP. ACL2 is both a programming language in which you can model computer systems and a tool to help proving properties of those models.
Arc is a dialect of the Lisp programming language now under development by Paul Graham and Robert Tappan Morris.In 2001 Paul Graham announced that he was working on a new dialect of Lisp named "Arc".... – a new sub version of Lisp created by Paul Graham, released on January 29, 2008.
Clojure is a modern dialect of the Lisp programming language. It is a general-purpose language sporting interactive development, and it encourages a functional programming style that enables simplified Thread programming.... - a modern Lisp dialect which runs on the Java Virtual Machine
Java Virtual Machine
A Java Virtual Machine is a set of computer software programs and data structures which use a virtual machine model for the execution of other computer programs and Scripting language.... . Designed with concurrency in mind.
For more information about various dialects of Lisp see category Lisp programming language family, and .
Artificial intelligence is the intelligence of machines and the branch of computer science which aims to create it. Major AI textbooks define the field as "the study and design of intelligent agents,"... research community, especially on PDP-10
PDP-10
The PDP-10 was a mainframe computer manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10".... systems. Lisp was used as the implementation of the programming language Micro Planner
Planner programming language
Planner is a programming language designed by Carl Hewitt at MIT, and first published in 1969. First subsets such as Micro-Planner and Pico-Planner were implemented, and then essentially the whole language was implemented in Popler.... that was the foundation for the famous AI system SHRDLU
SHRDLU
SHRDLU was an early natural language understanding computer program, developed by Terry Winograd at MIT from 1968-1970. It was written in the Planner programming language and Lisp programming language on the Digital Equipment Corporation PDP-6 computer and a DEC graphics computer terminal.... . In the 1970s, as AI research spawned commercial offshoots, the performance of existing Lisp systems became a growing issue.
Lisp was a difficult system to implement with the compiler techniques and stock hardware of the 1970s. Garbage collection
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage , or memory used by Object that will never be accessed or mutated again by the Application software.... routines, developed by then-MIT graduate student Daniel Edwards, made it practical to run Lisp on general-purpose computing systems, but efficiency was still a problem. This led to the creation of Lisp machine
Lisp machine
Lisp machines were general-purpose computers designed to efficiently run Lisp programming language as their main programming language. In a sense, they were the first commercial single-user Computer workstation.... s: dedicated hardware for running Lisp environments and programs. Advances in both computer hardware and compiler technology soon made Lisp machines obsolete, to the detriment of the Lisp market.
During the 1980s and 1990s, a great effort was made to unify the numerous Lisp dialects (most notably, InterLisp
Interlisp
Interlisp was a programming environment built around a version of the Lisp programming language. Interlisp development began in 1967 at Bolt, Beranek and Newman in Cambridge, Massachusetts as BBN LISP, which ran on PDP-10 machines running the TENEX operating system.... , Maclisp
Maclisp
MACLISP is a dialect of the Lisp programming language programming language. It originated at Massachusetts Institute of Technology's Project MAC in the late 1960s and was based on Lisp 1.5.... , ZetaLisp
ZetaLisp
ZetaLisp was the name Symbolics gave to their dialect of Lisp programming language on their Lisp Machine models, to distinguish it from the MIT version, which was called Lisp Machine Lisp.... , MetaLisp, and Franz Lisp
Franz Lisp
Franz Lisp, written at UC Berkeley by the students of Professor Richard Fateman, was a Lisp programming language system based largely on Maclisp, but written specifically to be a host for running the Macsyma Computer algebra on a VAX.... ) into a single language. The new language, Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... , was essentially a compatible subset of the dialects it replaced. In 1994, ANSI published the Common Lisp standard, "ANSI X3.226-1994 Information Technology Programming Language Common Lisp." At that time the world market for Lisp was much smaller than it is today.
Since 2000
Having declined somewhat in the 1990s, Lisp experienced a regrowth of interest. Most new activity is focused around open source
Open source
Open source is an approach to design, development, and distribution offering practical accessibility to a product's source . Some consider open source as one of various possible design approaches, while others consider it a critical Strategy element of their business operations.... implementations of Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... , and includes the development of new portable libraries and applications. This interest can be measured partly by sales from the print version of Practical Common Lisp
Practical Common Lisp
Practical Common Lisp is an introductory book on Common Lisp by Peter Seibel which intersperses "practical" chapters along with a fairly complete introduction to the language.... by Peter Seibel, a tutorial for new Lisp programmers published in 2004. It was briefly Amazon.com
Amazon.com
Amazon.com, Inc. is an American electronic commerce company in Seattle, Washington. It is America's largest online retailer, with nearly three times the internet sales revenue of runner up Staples, Inc.... 's second most popular programming book. It is available online for free.
Many new Lisp programmers were inspired by writers such as Paul Graham
Paul Graham
Paul Graham is a programmer, venture capitalist, and essayist, known for his work on Lisp . He is the author of On Lisp , ANSI Common Lisp , and Hackers & Painters .... and Eric S. Raymond
Eric S. Raymond
Eric Steven Raymond , often referred to as ESR, is a computer programmer, author and open source software advocate. His name became known within the hacker culture when he became the maintainer of the "Jargon File".... to pursue a language others consider 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
AI winter
In the history of artificial intelligence, an AI winter is a period of reduced funding and interest in artificial intelligence research. The process of Hype cycle, disappointment and funding cuts are common in many emerging technologies , but the problem has been particularly acute for AI.... " and Lisp's brief gain in the mid-1990s.
Dan Weinreb lists in his survey of Common Lisp implementations 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 community has created new supporting infrastructure: Cliki
CLiki
CLiki is a "free collaborative hypertext authoring program", a Wiki written in Common Lisp. It is also a website using the software and dedicated to the subject of Common Lisp.... is a Wiki that collects Common Lisp related information, the lists resources, #lisp is a popular IRC channel (with support by a Lisp-written Bot), supports the sharing and commenting of code snippets, collects the contents of various Lisp-related Blogs, on user discuss Lisp topics, is a service for announcing job offers and there is a new weekly news service ().
50 years of Lisp (1958-2008) has been celebrated at . There are several regular local user meetings (Boston, Vancouver, , ...), Lisp Meetings (, ) and an .
The Scheme community actively maintains over twenty implementations. Several significant new implementations (Chicken, Gauche, Ikarus, Larceny, Ypsilon) have been developed in the last few years. The standard of Scheme was widely accepted in the Scheme community. The Scheme Requests for Implementation
Scheme Requests for Implementation
Scheme Requests for Implementation is an effort to coordinate libraries and extensions of standard Scheme , necessitated by Scheme's minimalistic design, and particularly the lack of a standard library prior to R6RS.... 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.
There are also a few new dialects of Lisp. Notably: Newlisp
NewLISP
Newlisp is an open source Scripting language in the Lisp programming language developed by Lutz Mueller and released under the GNU General Public License.... (a scripting language), Arc (developed by Paul Graham) and recently Clojure
Clojure
Clojure is a modern dialect of the Lisp programming language. It is a general-purpose language sporting interactive development, and it encourages a functional programming style that enables simplified Thread programming.... (developed by Rich Hickey) and Nu for programming with Apple's Cocoa.
Major dialects
The two major dialects of Lisp used for general-purpose programming today are Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... and Scheme. These languages represent significantly different design choices.
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... , descended mainly from MacLisp
Maclisp
MACLISP is a dialect of the Lisp programming language programming language. It originated at Massachusetts Institute of Technology's Project MAC in the late 1960s and was based on Lisp 1.5.... , Interlisp
Interlisp
Interlisp was a programming environment built around a version of the Lisp programming language. Interlisp development began in 1967 at Bolt, Beranek and Newman in Cambridge, Massachusetts as BBN LISP, which ran on PDP-10 machines running the TENEX operating system.... , and Lisp Machine Lisp
Lisp Machine Lisp
Lisp Machine Lisp is a dialect of the Lisp programming language, a direct descendant of Maclisp, and was initially developed in the mid to late 1970s as the systems programming language for the Massachusetts Institute of Technology Lisp machines.... , is an expanded superset of earlier Lisp dialects, with a large language standard including many built-in data types and syntactic forms, as well as an object system. Scheme is a more minimalist design, with a much smaller set of standard features but with certain implementation features (such as tail-call optimization and full continuation
Continuation
In computing and programming, a continuation is an abstract representation of Control flow, or the "rest of computation" or "rest of code to be executed".... s) not necessarily found in Common Lisp. Common Lisp also borrowed certain features from Scheme such as lexical scoping
Scope (programming)
In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes.... and lexical closures.
Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. 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
Scheme Requests for Implementation is an effort to coordinate libraries and extensions of standard Scheme , necessitated by Scheme's minimalistic design, and particularly the lack of a standard library prior to R6RS.... .
A scripting language, script language or extension language, is a programming language that allows some control of a single or many Application software.... s in a number of applications, with the most well-known being Emacs Lisp
Emacs Lisp
Emacs Lisp is a dialect of the Lisp programming language used by the GNU Emacs and XEmacs text editors . It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C .... in the Emacs
Emacs
Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than any other editor or word processor, numbering over 1,000.... editor, Visual Lisp in AutoCAD, Nyquist in Audacity (a popular audio editor).
In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in a primitive type of the language itself, from homo meaning the same and icon meaning representation.... programming language: the primary representation of program code is the same type of list structure that is also used for the main data structures. As a result, Lisp functions can be manipulated, altered or even created within a Lisp program without extensive parsing or manipulation of binary machine code. This is generally considered one of the primary advantages of the language with regards to its expressiveness, and makes the language amenable to metacircular evaluation.
The now-ubiquitous if-then-else structure, now taken for granted as an essential element of any programming language, was invented by McCarthy for use in Lisp, where it saw its first appearance in a more general form (the cond structure). It was inherited by Algol, which popularized it.
Alan Curtis Kay is an United States computer scientist, known for his early pioneering work on object-oriented programming and Window graphical user interface design.... , the leader of the research on Smalltalk
Smalltalk
Smalltalk is an Object-oriented programming, Type system, reflection computer programming programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human?computer symbiosis." It was designed and created in part for educational use, more so for constructionist learning, at PARC by Al... , and then in turn Lisp was influenced by Smalltalk, by adopting object-oriented programming features (classes, instances, etc.) in the late 1970s.
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
Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing.... and the ALGOL
Algol
Algol , known colloquially as the Demon Star, is a bright star in the constellation Perseus . It is one of the best known eclipsing binary, the first such star to be discovered, and also one of the first variable stars to be discovered.... -descended C
C (programming language)
C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system.... language. Newer languages such as Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java .... and Python
Python (programming language)
Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive.... have incorporated some limited versions of some of the features of Lisp, but are necessarily unable to bring the coherence and synergy of the full concepts found in Lisp. Because of its suitability to ill-defined, complex, and dynamic applications, Lisp is currently enjoying some resurgence of popular interest.
Syntax and semantics
Note: This article's examples are written in Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... (though most are also valid in Scheme).
Lisp is an expression-oriented language. Unlike most other languages, no distinction is made between "expressions"
Expression (programming)
An expression in a programming language is a combination of value s, variables, operator s, and function s that are interpreted according to the particular Order of operations and of association for a particular programming language, which computes and then produces another value.... and "statements"
Statement (programming)
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program is formed by a sequence of one or more 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 then can be embedded into other expressions. Each value can be any data type.
McCarthy's 1958 paper introduced two types of syntax: S-expression
S-expression
The term S-expression or sexp refers to a convention for representing semi-structured data in human-readable textual form. S-expressions are probably best known for their use in the Lisp programming language family of programming languages.... s (Symbolic Expressions, also called "sexps"), which mirror the internal representation of code and data; and M-expression
M-expression
In computer programming, M-expressions were intended to be the expressions used to write functions in the Lisp . Data to be manipulated using M-expressions was to be written using S-expressions.... s (Meta Expressions), 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 extremely regular, 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. XMLisp, for instance, is a Common Lisp extension that employs the metaobject-protocol to integrate S-expressions with the Extensible Markup Language (XML).
The reliance on expressions gives the language great flexibility. Because Lisp functions are themselves written as lists, they can be processed exactly like data. This allows easy writing of programs which manipulate other programs (metaprogramming
Metaprogramming
Metaprogramming is the writing of computer programs that write or manipulate other programs as their data, or that do part of the work at runtime that would otherwise be done at compile time.... ). Many Lisp dialects exploit this feature using macro systems, which enables extension of the language almost without limit.
A Lisp list is written with its elements separated by whitespace, and surrounded by parentheses. For example, (1 2 foo) is a list whose elements are three atoms: the values 1, 2, and foo
Metasyntactic variable
The phrase metasyntactic variable is a neologism that is used in some programmer communities to describe a placeholder name or an Aliasing term commonly used to denote the subject matter under discussion or an arbitrary member of a class of things under discussion.... . 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 nil. This is the only entity in Lisp which is both an atom and a list.
Expressions are written as lists, using prefix notation. The first element in the list is the name of a form, i.e., a function, operator, macro, or "special operator" (see below.) The remainder of the list are the arguments. For example, the function list returns its arguments as a list, so the expression
(list '1 '2 'foo)
evaluates to the list (1 2 foo). The "quote" before the arguments in the preceding example is a "special operator" which prevents the quoted arguments from being evaluated (not strictly necessary for the numbers, since 1 evaluates to 1, etc). Any unquoted expressions are recursively evaluated before the enclosing expression is evaluated. For example,
(list 1 2 (list 3 4))
evaluates to the list (1 2 (3 4)). Note that the third argument is a list; lists can be nested.
Arithmetic operators are treated similarly. The expression
(+ 1 2 3 4)
evaluates to 10. The equivalent under infix notation
Infix notation
Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on .... would be "1 + 2 + 3 + 4". Arithmetic operators in Lisp are variadic
Variadic function
In computer programming, a variadic function is a function of variable arity; that is, one which can take different numbers of arguments. Support for variadic functions differs widely among programming languages.... (or n-ary), able to take any number of arguments.
"Special operators" (sometimes called "special forms" by older users) provide Lisp's control structure. For example, the special operator if 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 (3 4 "bar"). Of course, this would be more useful if a non-trivial expression had been substituted in place of nil.
Lambda expressions
Another special operator, lambda, 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 lambda 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 arg 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 6.
Atoms
In the original LISP there were two fundamental data type
Data type
A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it.... s: atoms and lists. A list was a finite ordered sequence of elements, where each element is in itself either an atom or a list, and an atom was a number
Number
A number is a mathematical object used in counting and measurement. A notational symbol which represents a number is called a Numeral system, but in common usage the word number is used for both the abstract object and the symbol, as well as for the numeral for the number.... or a symbol. A symbol was essentially a unique named item, written as an Alphanumeric
Alphanumeric
Alphanumeric is a portmanteau of alphabetic and numeric and is used to describe the collection of Latin alphabet and Arabic numerals used by much of western society.... string in source code
Source code
In computer science, source code is any collection of statements or declarations written in some human-readable computer programming language.... , and used either as a variable name or as a data item in symbolic processing. For example, the list (FOO (BAR 1) 2) contains three elements: the symbol FOO, the list (BAR 1), 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 the exact 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
Programming 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 to read and understand source code conforming to the style, and help to avoid introducing errors.... s evolved, the concept of an atom lost importance. Many dialects still retained the predicate atom for legacy compatibility, defining it true for any object which is not a cons.
Conses and lists
A Lisp list is a singly-linked list. Each cell of this list is called a cons (in Scheme, a pair), and is composed of two pointers, called the car and cdr. These are equivalent to the data and next fields discussed in the article linked list
Linked list
In computer science, a linked list is one of the fundamental data structures, and can be used to implement other data structures. It consists of a sequence of node s, each containing arbitrary data Field s and one or two reference s pointing to the next and/or previous nodes.... , respectively.
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 nil (empty list) symbol, or a cons in which the car points to a datum (which may be another cons structure, such as a list), and the cdr 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 car and cdr functions are also called first and rest 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 which 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 a number of higher-order function
Higher-order function
In mathematics and computer science, higher-order functions or functional are function s which do at least one of the following:*take one or more functions as an input... 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 (array
Array
In computer science, an array is a data structure consisting of a group of element s that are accessed by index . In most programming languages each element has the same data type and the array occupies a contiguous area of computer memory.... s), hash tables, structures, and so forth.
S-expressions represent lists
Parenthesized S-expressions represent linked list structure. There are several ways to represent the same list as an S-expression. A cons can be written in dotted-pair notation as (a . b), where a is the car and b the cdr. A longer proper list might be written (a . (b . (c . (d . nil)))) in dotted-pair notation. This is conventionally abbreviated as (a b c d) in list notation. An improper list may be written in a combination of the two – as (a b c . d) for the list of three conses whose last cdr is d (i.e., the list (a . (b . (c . d))) 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 list 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 cons
Cons
In computer programming, cons is a fundamental subroutine in most dialects of the Lisp programming language. cons constructs memory objects which hold two values or pointers to values.... procedure can be used to add an element to the front of a list. Note that the cons 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 append
Append
In general, to append is to join or add on to the end of something. For example, an appendix is a section appended of a document.... procedure appends two (or more) lists to one another. Because Lisp lists are linked lists, appending two lists has asymptotic time complexity
Big O notation
In mathematics, big O notation describes the asymptotic analysis of a function when the argument tends towards a particular value or infinity, usually in terms of simpler functions.... .
(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 foo and bar are (a b c) and (x b c) respectively. However, the tail (b c) is the same structure in both lists. It is not a copy; the cons cells pointing to b and c 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 c with a goose, will affect the other:
(setf (third foo) 'goose)
This changes foo to (a b goose), but thereby also changes bar to (x b goose) – 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.
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of function s and avoids program state and immutable object data.... 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 set-car! (read set car bang), which replaces the car of a cons. In the Common Lisp dialect, destructive functions are commonplace; the equivalent of set-car! is named rplaca for "replace car." This function is rarely seen however as Common Lisp includes a special facility, setf, 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; (+ 2 3) evaluates to 5. However, most other forms evaluate to themselves: if you enter 5 into Lisp, it returns 5.
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 quote special operator, or its abbreviation ' (a single quotation mark). For instance, usually if you enter the symbol foo you will get back the value of the corresponding variable (or an error, if there is no such variable). If you wish to refer to the literal symbol, you enter (quote foo) or, usually, 'foo.
Both Common Lisp and Scheme also support the backquote operator (often called quasiquote by Schemers), entered with the ` character. 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 and comma-at operators. If the variable snue has the value (bar baz) then `(foo ,snue) evaluates to (foo (bar baz)), while `(foo ,@snue) evaluates to (foo bar baz). The backquote is most frequently used in defining macro expansions.
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 iterations.
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).
Douglas Richard Hofstadter is an United States academic whose research focuses on consciousness, thinking and creativity. He is best known for G?del, Escher, Bach, first published in 1979, for which he was awarded the 1980 Pulitzer Prize for general non-fiction.... (in Gödel, Escher, Bach
Gödel, Escher, Bach
G?del, Escher, Bach: an Eternal Golden Braid is a Pulitzer Prize-winning book by Douglas Hofstadter, described by the author as "a metaphorical fugue on minds and machines in the spirit of Lewis Carroll".... ) and others as an example of the philosophical
Philosophy
Philosophy is the study of general problems concerning matters such as existence, knowledge, truth, beauty, justice, validity, mind, and language.... idea of self-reference
Self-reference
Self-reference is a phenomenon in natural language or formal languages consisting of a Sentence or formula referring to itself directly, or through some intermediate sentence or formula, or by means of some Semantics encoding.... .
Scope and closure
The modern Lisp family splits over the use of dynamic or static (aka lexical) scope
Scope (programming)
In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes.... . Scheme and Common Lisp make use of static scoping by default, while Newlisp
NewLISP
Newlisp is an open source Scripting language in the Lisp programming language developed by Lutz Mueller and released under the GNU General Public License.... and the embedded languages in Emacs
Emacs
Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than any other editor or word processor, numbering over 1,000.... and AutoCAD use dynamic scoping.
List structure of program code
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 macros operate on these structures. 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. Macros in C
C (programming language)
C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system.... , for instance, operate on the level of the preprocessor
Preprocessor
In computer science, a preprocessor is a Computer program that processes its input data to produce output that is used as input to another program.... , before the parser is invoked, and cannot re-structure the program code in the way Lisp macros can.
In simplistic Lisp implementations, this list structure is directly interpreted
Interpreter (computing)
In computer science, an interpreter normally means a computer program that execution , i.e. performs, instructions written in a programming language.... to run the program; a function is literally a piece of list structure which is traversed by the interpreter in executing it. However, most actual Lisp systems (including all conforming Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... systems) also include a compiler. The compiler translates list structure into machine code or bytecode
Bytecode
Bytecode is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software Interpreter as well as being suitable for further compilation into machine language.... for execution.
An integrated development environment also known as integrated design environment or integrated debugging environment is a software application that provides comprehensive facilities to computer programmers for software development.... . 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
Read-eval-print loop
A read-eval-print loop , also known as an interactive toplevel, is a simple, interactive computer programming environment. The term is most usually used to refer to a Lisp programming language interactive environment, but can be applied to command line interface shell and similar environments for Smalltalk, Python , Ruby , Haskell , AP... ", or 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 read function accepts textual S-expressions as input, and parses them into an internal data structure. For instance, if you type the text (+ 1 2) at the prompt, read 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 foo will be read as a single symbol. 123 will be read as the number 123. "123" will be read as the string "123".
The eval 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, eval 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 (1 2) yields the answer 3. This is the result of the evaluation.
The symbol foo evaluates to the value of the symbol foo. Data like the string "123" evaluates to the same string. The list (quote (1 2 3)) evalutes to the list (1 2 3).
It is the job of the print function to represent output to the user. For a simple result such as 3 this is trivial. An expression which evaluated to a piece of list structure would require that print 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 eval will be complicated, since it must also implement all special operators like if or lambda.) This done, a basic REPL itself is but a single line of code: (loop (print (eval (read)))).
The Lisp REPL typically also provides input editing, an input history, error handling and an interface to the debugger.
Eager evaluation or strict evaluation is the evaluation strategy in most traditional programming languages.In eager evaluation an Expression is evaluated as soon as it gets bound to a variable.... . In Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... , arguments are evaluated in applicative order ('leftmost innermost'), while in Scheme
Scheme programming language
Scheme is a multi-paradigm programming language. It is one of the two main programming language dialect of Lisp programming language and supports a number of programming paradigms but is best known for its support of functional programming.... 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, cond, is the precursor to later if-then-else structures.)
Scheme is a multi-paradigm programming language. It is one of the two main programming language dialect of Lisp programming language and supports a number of programming paradigms but is best known for its support of functional programming.... dialect often express loops using tail recursion
Tail recursion
In computer science, tail recursion is a special case of Recursion_ in which the last operation of the function, the tail call, is a recursive call.... . 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; this is incorrect. All frequently seen Lisp dialects have imperative-style iteration constructs, from Scheme's do loop to Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... 's complex loop 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
Tail call
A tail call is a call to a subroutine which is followed by a return to the calling code. Such a call is said to be in tail position. If a subroutine performs a tail call to itself, it is called tail recursion.... s, and consequently the reason that the use of tail recursion is generally encouraged for Scheme is that the practice is expressly supported by the language definition itself. By contrast, ANSI Common Lisp does not require the optimization commonly referred to as tail call elimination. Consequently, the fact that tail recursive style as a casual replacement for the use of more traditional iteration
Iteration
Iteration means the act of repeating.... constructs (such as do, dolist or loop) is discouraged 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
Branch (computer science)
A branch is a point in a computer program where the flow of control is altered. The term branch is usually used when referring to a program written in machine code or assembly language; in a high-level programming language, branches usually take the form of conditional statements, subroutine calls or GOTO statements.... ) and program correctness (since tail recursion may increase stack use in Common Lisp, risking stack overflow
Stack overflow
In software, a stack overflow occurs when too much computer memory is used on the call stack. In many programming languages the call stack contains a limited amount of memory, usually determined at the start of the program.... ).
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 the programmer to implement control structures using the language itself. 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
Continuation
In computing and programming, a continuation is an abstract representation of Control flow, or the "rest of computation" or "rest of code to be executed".... s using the call/cc 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.
Frequently, 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 (programming language)
Haskell is a standardized, purely functional programming language with non-strict programming language, named after logician Haskell Curry. The goals of the language are described as:... .
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 for 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 map and in Common Lisp is called mapcar. Given a function and one or more lists, mapcar 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 (11 22 33 44 55).
Examples
Here are examples of Common Lisp code.
The basic "Hello world" program:
(print "Hello world")
As the reader may have noticed from the above discussion, Lisp syntax lends itself naturally to recursion. Mathematical problems such as the enumeration of recursively defined sets are simple to express in this notation.
In mathematics, the factorial of a negative and non-negative numbers integer n, denoted by n!, is the Product of all positive integers less than or equal to n.... :
(defun factorial (n)
(if (<= n 1)
1
(* n (factorial (- n 1)))))
An alternative implementation, often faster than the previous version if the Lisp system has tail recursion
Tail recursion
In computer science, tail recursion is a special case of Recursion_ in which the last operation of the function, the tail call, is a recursive call.... optimization:
(defun factorial (n &optional (acc 1))
(if (<= n 1)
acc
(factorial (- n 1) (* acc n))))
Contrast with an iterative version which uses Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... 's loop 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 (l &optional acc)
(if (atom l)
acc
(-reverse (cdr l) (cons (car l) acc))))
Object systems
Various object systems and models have been built on top of, alongside, or into Lisp, including:
ObjectLisp or Object Lisp, used by Lisp Machines Incorporated and early versions of Macintosh Common Lisp
LOOPS (Lisp Object-Oriented Programming System) and the later CommonLOOPS
CommonLoops
CommonLoops is an early program which extended Common Lisp to include Object-oriented programming functionality and is a dynamic programming language object system which differs radically from the OOP facilities found in static languages such as C++ or Java ....
The Massachusetts Institute of Technology is a private university research university located in Cambridge, Massachusetts, Massachusetts, United States.... , and its descendant New Flavors (developed by Symbolics
Symbolics
Symbolics refers to two companies: now-defunct 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 constraint
Constraint
Constraint may refer to:* Constraint * Constraint algorithm such as SHAKE, or LINCS* Constraint ** Loading gauge versus structure gauge* Constraint ... s-based object system developed to aid the writing of Garnet, a GUI library for Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... .
IntelliCorp is a software company that provides, develops, and markets SAP application lifecycle management, business process management and data management software for SAP customers and partners.... used an object system called UNITS and integrated it with an inference engine
Inference engine
In computer science, and specifically the branches of knowledge engineering and artificial intelligence, an inference engine is a computer program that tries to derive answers from a knowledge base.... . and a truth maintenance system (ATMS).
The Common Lisp Object System, CLOS. CLOS is an integral part of ANSI Common Lisp
Common Lisp
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 .... . CLOS descended from New Flavors and CommonLOOPS. ANSI Common Lisp was the first standardized object-oriented Programming Language (1994, ANSI X3J13).
Various dialects and implementations
Since the first Lisp in 1958 a lot of implementations of Lisp have been created. Lisp has some standardized dialects like Common Lisp (ANSI), Scheme (ANSI, IEEE) and ISLisp (ISO). There are also a lot of Lisp implementations of Lisp dialects that are based on an informal standard. Lisp dialects like Portable Standard Lisp, Emacs Lisp and InterLisp are in this category. Third there are also many Lisp systems that implement their own dialect of Lisp.
Lush (Lisp Universal Shell) is an object-oriented Lisp dialect initially developed as a Scripting language
Scripting language
A scripting language, script language or extension language, is a programming language that allows some control of a single or many Application software.... .
M&P incorporates mpLISP, a minimum Lisp dialect that enables the development of model-driven systems.
ExperCommonLISP was derived from the ExperLISP product available for the Mac. It is no longer available.
For more information about various dialects of Lisp see category Lisp programming language family, and .
Structure and Interpretation of Computer Programs is a textbook published in 1985 about general computer programming concepts from MIT Press written by Massachusetts Institute of Technology professors Harold Abelson and Gerald Jay Sussman, with Julie Sussman.... , by Harold Abelson, Gerald Jay Sussman
Gerald Jay Sussman
Gerald Jay Sussman is the Panasonic Professor of Electrical engineering at the Massachusetts Institute of Technology . He received his Bachelor of Science and Doctor of Philosophy degrees in mathematics from MIT in 1968 and 1973 respectively.... and Julie Sussman. 1996 (2nd edition), MIT Press; ISBN 0262011530
Transcript may refer to:* An RNA molecule, a type of compound produced directly from genes* Transcript , a copy of a student's permanent academic record... of Richard Stallman
Richard Stallman
Richard Matthew Stallman , often abbreviated "rms","'Richard Stallman' is just my mundane name; you can call me 'rms'"|last= Stallman... 's speech, 28 Oct 2002, at the International Lisp Conference
Paul Graham is a programmer, venture capitalist, and essayist, known for his work on Lisp . He is the author of On Lisp , ANSI Common Lisp , and Hackers & Painters .... ,
Hackers & Painters: Big Ideas from the Computer Age is a collection of essays from Paul Graham discussing Hacker .It is also the title of one of those essays.... , 2004, O'Reilly, ISBN 0-596-00662-4
Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 ....
Clojure is a modern dialect of the Lisp programming language. It is a general-purpose language sporting interactive development, and it encourages a functional programming style that enables simplified Thread programming....
Object Lisp was an object-oriented Lisp programming language computer programming languages designed by Lisp Machines, Inc. Object Lisp is an early example of Prototype-based programming....
Artificial intelligence is the intelligence of machines and the branch of computer science which aims to create it. Major AI textbooks define the field as "the study and design of intelligent agents,"...
In Lisp programming languages, a fexpr is a function whose operands are passed to it without being evaluated. When a fexpr is called, only the body of the fexpr is evaluated; no other evaluations take place except when explicitly initiated by the fexpr....
John McCarthy , is an United States computer scientist and cognitive scientist who received the Turing Award in 1971 for his major contributions to the field of Artificial Intelligence .... 's history of 12 Feb 79
- Herbert Stoyan's history compiled from the documents (acknowledged by McCarthy as more complete than his own, see: )
The Charles Babbage Institute is a research center at the University of Minnesota specializing in the history of information technology, particularly the history since 1935 of digital computing, programming/software, and computer networking.... , 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.
Usenet, a portmanteau of "user" and "network", is a worldwide distributed Internet discussion system. It evolved from the general purpose UUCP architecture of the same name.... newsgroup
Newsgroup
A newsgroup is a repository usually within the Usenet system, for messages Posting style from many users in different locations. The term may be confusing to some, because it is usually a discussion group....
Paul Graham is a programmer, venture capitalist, and essayist, known for his work on Lisp . He is the author of On Lisp , ANSI Common Lisp , and Hackers & Painters ....
with Richard P. Gabriel (Podcast)
, a useful package for lisp beginners - for Windows or Unix