|Paradigms :||multiparadigmatic: functional , procedural ; some dialects also modular , object-oriented , reflexive|
|Developer:||Steve Russell, Timothy P. Hart, Mike Levin|
|Dialects:||Common Lisp , Scheme , Emacs Lisp and many more|
|Influenced by:||Lambda calculus , Fortran , IPL|
|Affected:||Logo , Perl , Smalltalk , Clojure , Python , RPL , Ruby , Dylan , Mathematica , REBOL , Haskell , Snap! / BYOB|
Lisp is a family of programming languages that was specified for the first time in 1958 and was created at the Massachusetts Institute of Technology (MIT) based on the untyped lambda calculus . After Fortran, it is the second oldest programming language that is still in use.
Numerous dialects emerged on the basis of Lisp . Common Lisp and Scheme are among the most popular . Therefore, the term Lisp often refers to the language family and not to a specific dialect or implementation .
Lisp stands for Lis t P rocessing (list processing). This originally meant Fortran subroutines with which symbolic calculations such as those used in the lambda calculus were to be carried out. Steve Russell, one of John McCarthy's students , then came up with the fundamental idea of writing an interpreter for these expressions for the IBM 704 on the basis of his formulation of a "Lisp interpreter in Lisp" . The Lisp programming language was born.
The basic data structures of Lisp are single values (e.g. symbols, numbers, character strings), which are called atoms , and Cons cells from which lists are formed. The lists can be nested as required (lists of lists) . This also makes it easy to implement data structures such as an associative array . Lists are put in round brackets for representation in Lisp:
(A B C)
Program instructions are also (nested) lists in which the first list element in each case identifies the function to be performed. There is therefore no fundamental difference between data and programs; this property is called homonicity . The programmer can develop new control structures or object systems ( OOP ) ( metaprogramming , macros ). However, it also enables program parts to be manipulated as required during runtime.
Lisp offers the programmer great flexibility and extensive influence, which is why it is sometimes referred to as a programmable programming language . Data structures are built up dynamically without the programmer having to explicitly reserve or release memory space (see also garbage collection ). Declarations for data types are optional and a Lisp symbol can be used as a variable for any type of object. Many of these properties have been adopted in other programming languages over time. In the early 1960s, however, they were way ahead of their time.
In the 1970s and 1980s, special Lisp machines were developed and sold. These made it possible to run Lisp programs quickly, which was only possible on general computers at the time by renouncing type checking and automatic garbage collection . However, this has changed with faster computers.
Programs in Lisp can be interpreted or translated into efficient code by a compiler . Typical compilers are batch compilers or incremental compilers. Incremental compilers can translate individual expressions. Batch compilers translate individual Lisp files or entire Lisp programs. Compilers translate either into bytecode for a virtual machine , into other programming languages (often in C) for further translation, or into machine code for a processor .
The acronym LISP is sometimes jokingly interpreted as "Lots of Irritating Superfluous Parentheses" (a lot of annoying, superfluous parentheses).
Historically, Lisp, together with Prolog, is one of the most important programming languages in artificial intelligence . Lisp made the lambda calculus the core of a programming language for the first time. This is an essential element of the semantics of many modern programming languages.
In contrast to Europe, where programming languages such as Assembler , Fortran or Pascal were taught as classic representatives of the procedural programming language family, Lisp, or one of its more modern dialects such as Scheme , was and is in some cases the first taught programming language in the United States . This had a great influence, since the classic representatives of the procedural language families are representatives of a static way of processing data, while Lisp, among other things, represents a strictly dynamic concept.
Lisp uses S-Expressions as an external format to represent both source text and data. Function and macro calls are written as lists that contain the name of the function or macro as the first element. Comments are introduced with one or more
Examples in Common Lisp:
;; Addiere 2 und 3 und 4: (+ 2 3 4) ;; Setze die Variable p auf den Wert 3,1415: (setf p 3.1415) ;; Definiere eine Funktion, die ihr Argument quadriert: (defun square (x) (* x x)) ;; Quadriere die Zahl 3: (square 3)
LISP Hello World Program :
(princ "Hello, world!") (terpri)
(terpri)done a line break .
Minimal functionality for Lisp
To implement a minimal Lisp system, only very few operators and a general mechanism for function definition are necessary. The following features are included in the original McCarthy report:
first(returns the first element of a list; was originally called
car(from Contents of Address Register))
rest(returns the remaining list (without the first element); originally called
cdr(from Contents of Decrement Register))
cons(Creates a CONS pair from two pointers and returns a pointer to it. Can be used, for example, to append an element to the beginning of a list) (from CONStruct)
quote(prevents the evaluation of the following object)
eq(Test for the identity of two or more objects)
cond(Conditional execution: Adopts a list of any length of pairs, each consisting of a condition and a calculation rule. Returns the evaluation result of the first calculation rule whose associated condition is true)
- Function definition mechanism
A remarkable part of the functions that common Lisp systems bring with them can be defined with these language elements.
In the original version of Lisp, there were two basic types of data : atoms and lists . Atoms were so named because they couldn't be changed. Lists were sequences of elements, and these elements could be atoms or sub-lists. An atom was either a number or a symbol. A symbol was an alphanumeric string that was used as a variable name or data element in symbolic arithmetic.
Internally, a symbol atom was only saved once in the symbol table . Two symbol atoms that were spelled the same and appeared in different places in the source code represented the same object.
Later other data types were introduced in the Lisp dialects, and the concept of Lisp atoms lost its importance.
"Lisp is a programmable programming language."
"Lisp is a programmable programming language."
"Lisp seems to be a lucky discovery of a local maximum in the space of programming languages."
"Lisp seems to be the happy discovery of a local maximum in the multitude of programming languages."
Dialects commonly used today
- Common Lisp is the most extensive and most commonly used Lisp dialect. It is ANSI standardized and offers support for procedural macros, lexical and dynamic variable binding and much more. The name recalls the intention to combine several incompatible efforts to find a successor for Maclisp ( ZetaLisp , Spice Lisp , NIL and S-1 Lisp ). Other influences were InterLisp and Scheme .
- Scheme is a minimal and elegant variant that u. a. Continuations supported. In contrast to Common Lisp, it only knows lexical variable binding and hygienic macros. Due to its simplicity, it is often used in teaching, although productive programming is also possible and practiced with it.
- Emacs Lisp is the scripting language of the GNU Emacs text editor .
Historically relevant dialects
- LISP 1.5 was the first Lisp version to be distributed beyond MIT and contains the first functional source of a Lisp implementation.
- Maclisp was a widespread and influential forerunner of Common Lisp and the original implementation language of the Macsyma computer algebra system .
- InterLisp developed from BBN-Lisp in 1967 and was further developed to Interlisp-D , which formed a complete development system for the Lisp machine Xerox Dolphin . In 1992 the ACM presented the Software System Award to Daniel G. Bobrow , Richard R. Burton, L Peter Deutsch , Ronald Kaplan, Larry Masinter and Warren Teitelman for their pioneering work at InterLisp.
- ZetaLisp (also called Lisp Machine Lisp ) is a further development of Maclisp and ran on various Lisp machines . Flavors , the first object-oriented extension, was developed on the basis of this dialect .
- Franz Lisp was developed from MacLisp in 1978 to run the Macsyma computer algebra system on a VAX . It was widely used because it shipped with BSD Unix . Later the company Franz Inc. was founded to maintain this Lisp. Franz Inc. has been selling a Common Lisp implementation (Allegro CL) since the mid-1980s.
- XLISP is a LISP with object-oriented extensions that also ran on weaker computers. A well-known application is the XLispStat statistics package.
- EuLisp was a European attempt to define a tidy and uniform Lisp.
- ISLisp is an ISO -standardized, compact Lisp dialect that is suitable for programming embedded systems .
- Portable Standard Lisp and the so-called Standard Lisp were developed at the University of Utah from 1980 and were mainly used for the computer algebra system Reduce . It could be used in an ALGOL-like syntax as the RLISP script language .
- S-1 Lisp was a Lisp for the S-1 Mark IIA supercomputer .
Dialects for special purposes
- AutoLISP is the scripting language for the AutoCAD CAD system based on an early version of XLISP .
- librep or rep for short is a scripting language for Unix-like systems and was initially based on Emacs Lisp , but has lexical instead of dynamic variable binding . The Sawfish window manager was written in rep.
- muLISP runs under CP / M and MS-DOS as well as on some programmable pocket calculators . It was used to implement the Derive computer algebra system.
- Nyquist is a sound synthesis and analysis language based on XLISP.
- Racket is a Scheme dialect primarily designed for the development of programming languages.
- RPL runs on programmable pocket calculators, especially those from Hewlett-Packard . It is a Lisp version mixed with the reverse Polish notation .
- System Management Language has been expanded to include language structures for object and event- oriented programming. It contains APIs for X / Motif , CMIS and others.
- Arc is a dialect developed by Paul Graham and Robert Morris .
- Clojure is a Lisp dialect for the Java Virtual Machine and is incompatible with other Lisp dialects and standards.
- NewLISP is a scripting language
- Hy is a Lisp dialect that is closely linked to Python.
- lfe is a Lisp dialect for the Erlang VM
- John Allen: Anatomy of Lisp . McGraw-Hill, 1978, ISBN 0-07-001115-X .
- Christian Queinnec: Lisp in Small Pieces . Cambridge University Press, 2003, ISBN 0-521-54566-8 .
- Patrick Henry Winston, Berthold Horn: Lisp . Addison-Wesley Verlag, 1987, ISBN 3-925118-61-6 .
- Walter Sonnenberg: Use of Lisp to define and implement programming languages similar to Algol. University of Karlsruhe, 1970.
- Harold Abelson, Gerald Jay Sussman : Structure and Interpretation of Computer Programs (SICP) . MIT Press, 1993, ISBN 978-0-262-01153-2 .
- Lisp 1.5 Programmer's Manual (PDF; 4.5 MB)
- John McCarthy: Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I (PDF; 214 kB)
- A concise introduction based on McCarthy's work (PostScript)
- Paul McJones (Ed.): History of LISP by the Software Preservation Group at the Computer History Museum
- Paul Graham: The Roots of Lisp (PDF; 141 kB)
- ELM-ART - an interactive learning program for an introduction to the Lisp programming language
- Guy L. Steele Jr. & Richard P. Gabriel: The Evolution of Lisp (PDF; 568 kB)
- Lisp - The mother of all programming languages . CRE , 01: 35: 27h