Lisp (programming language)
Lisp is a family of programming languages which was founded in 1958 for the first time specified and at the Massachusetts Institute of Technology (MIT) was inspired by the lambda calculus. It is the second oldest after Fortran programming language, which is still widespread.
On the basis of Lisp numerous dialects emerged. The most famous include Common Lisp and Scheme. Therefore, the term often refers to the Lisp language family and not to a specific dialect or a concrete implementation.
Lisp stands for List Processing ( list processing ). This was originally meant Fortran subroutines with which symbolic calculations should be carried out as they are needed in the lambda calculus. Steve Russell, one of the students of John McCarthy came on the fundamental idea to program an interpreter for these expressions, which the Lisp programming language was born.
The basic data structures of Lisp are single values ( scalar values ), which are called atoms, and lists. The lists can be nested ( lists of lists). This can also be easily implemented as an associative array data structures. The lists are shown in round brackets:
(A B C ) Also, program instructions are lists, the first list element identifies the function to be performed. Thus, there is no fundamental difference between data and program instructions; This property is called Homoikonizität. The programmer can then, for example, new control structures or object systems ( OOP) develop ( metaprogramming, macros ). It also allows parts of the program at runtime to manipulate arbitrary.
Lisp allows the programmer great flexibility and far-reaching influence, which is why it is sometimes referred to as a programmable programming language. Data structures can be constructed dynamically, without the programmer must allocate or release memory explicitly (see also automatic garbage collection ). Declarations for data is not needed, and a LISP symbol can be used as variable denote any type of objects. Many of these properties have been included in other programming languages over time. However by the early 1960s they were far ahead of their time.
In the 1970s and 1980s, special Lisp machines were developed and distributed. This allowed the rapid execution of LISP programs, which only under the waiver of type checking and automatic garbage collection was possible to then general computers. This has changed with faster computers, however.
Programs in Lisp may be interpreted or translated by a compiler into efficient code. Typical compilers are batch or incremental compiler compiler. Incremental compilers can translate single expressions. Batch Compiler translate single Lisp files or entire Lisp programs. Compilers translate either into a bytecode for a virtual machine or in machine code for a processor.
The acronym LISP is interpreted ( a lot of annoying, unnecessary parentheses ) is sometimes jokingly referred to as "Lots of Irritating Superfluous Parentheses ".
Historically a part of Lisp together with a prologue to the main programming of artificial intelligence.
In contrast to Europe, where programming languages such as Assembler, Fortran or Pascal were taught as a classic representative of the family of procedural programming languages , was and still is to some extent today in the U.S. Lisp, or one of his more modern dialects such as Scheme, the first programming language taught. This had a great impact, as it is in the classical representatives of the procedural language families are representatives of a static way of processing data while on the other hand, among other Lisp represents a strictly dynamic concept.
Lisp used S-expressions as the external format, to present both the source code and data. Function and macro calls are written as lists containing as a first element the name of the function or macro. Comments to be; initiated.
Examples in Common Lisp:
;; Add 2 and 3 and 4: ( 2 3 4 ) ; ; Set the p variable to the value 3.1415: ( setf p 3.1415 ) ; ; Define a function that squares its argument: ( defun square (x ) ( X * x)) ; ; Squared- the number 3: (square 3) LISP Hello world program ( with ( terpri ) A new line ):
( princ "Hello, world !") ( terpri ) Minimal functions for Lisp
For implementing a minimum Lisp system, very few operators, and a general mechanism for the function definition are needed. The following functions are included in the original report of McCarthy:
- First ( returns the first element of a list back, was originally called car (from Contents of Address Register ) )
- Rest (returns the remainder of the list (without the first element); was originally cdr (from Contents of Decrement Register ) )
- Cons ( Creates two pointers a CONS - pair and returns a pointer to this. Can be used as an element to the beginning of a list to be added ) ( Construct )
- Quote (which prevents the evaluation of the following object)
- Eq (test for identity of two or more objects )
- Cond ( conditional execution. Takes an arbitrarily long list of pairs, each consisting of a condition and a calculation formula Returns the evaluation result of the first calculation specification, the associated condition is true)
- Mechanism to function definition lambda
Even with these language resources, a remarkable part of the functions, bring the usual Lisp systems are defined.
" 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 lucky discovery of a local maximum in the set of programming languages to be. "
Today dialects commonly used
- Common Lisp is the most extensive and most commonly used in practice Lisp dialect. He is ANSI standardized and provides support for procedural macros, lexical variables such as dynamic binding, and much more. The name recalls the intention to unite several incompatible efforts to find a successor for MACLISP ( ZetaLisp, Spice Lisp, NIL and S-1 Lisp ). Further influences were Interlisp and Scheme.
- Scheme is a minimal and elegant variation that supports inter alia continuations. Unlike Common Lisp knows only lexical variable binding and hygienic macros. It takes place due to its simplicity often use in teaching, although productive programming is possible with her and practiced.
- Emacs Lisp is the scripting language of the text editor GNU Emacs.
Historically relevant dialects
- LISP 1.5 was the first Lisp version that was distributed via the WITH addition and contains the first viable source of Lispimplementierung.
- MACLISP was a widespread and influential precursor of Common Lisp and the original implementation language of the computer algebra system Macsyma.
- Interlisp developed in 1967 from BBN - Lisp and has been further developed to Interlisp -D, which formed a complete development system for the Lisp Machine Xerox Dolphin. 1992 awarded the ACM software system award to Daniel G. Bobrow, Richard R. Burton, L. Peter German, Ronald Kaplan, Larry Masinter and Warren Teitelman for her pioneering work on Interlisp.
- ZetaLisp (also called Lisp Machine Lisp ) is an evolution of MacLisp and ran on various Lisp machines. On the basis of this dialect Flavors has developed the first object-oriented extension.
- Franz Lisp was developed in 1978 from MacLisp to let the computer algebra system Macsyma running on a VAX. It was widely read because it was shipped with BSD Unix. Later the company Franz Inc. was established to maintain this Lisp. Since the mid- 80s, Franz Inc. sells however, a Common Lisp implementation ( Allegro CL).
- XLISP is a LISP with object-oriented extensions, which ran on low-end computers. A well-known application is the statistical package xlispstat.
- EULISP was a European attempt to define a tidy and uniform Lisp.
- ISLisp is an ISO - standardized, compact Lisp dialect that is suitable for embedded systems programming.
- Portable Standard Lisp and the so-called standard Lisp was developed in 1980 at the University of Utah and used esp. for the computer algebra system Reduce. It was available in a ALGOL -like syntax scripting language RLISP.
- S-1 Lisp was a Lisp for the supercomputer S- 1 Mark IIA.
Dialects for special purposes
- AutoLISP is based on an early version of XLISP scripting language for the CAD system AutoCAD.
- Librep or short rep is a scripting language for unix -like systems and was based initially on Emacs Lisp but lexical variables instead of dynamic binding. The window manager sawfish was written in rep.
- MuLISP running under CP / M and MS- DOS, and on some programmable calculators. It was used to implement the computer algebra system Derive.
- Nyquist is a language for sound synthesis and analysis and is based on XLISP.
- RPL running on programmable calculators ( especially Hewlett- Packard). This is a LISP version, which was mixed with the inverse Polish notation.
- System Management Language is extended by language structures for object-oriented and event-driven programming. It includes APIs for CMIP, X / Motif, CMIS and more.