Definition Definition

Lisp Programming

LISP (List Processor) a programming language developed in the late 1950s at MIT under the direction of John McCarthy. Because of the ease with which it can handle complex data structures, Lisp is used for artificial intelligence research and for writing programs whose complexity would render them unmanageable in other languages.

A Lisp program is easy to recognize because of the accumulation of closing parentheses at the end of the program. All Lisp statements and most Lisp data structures are linked lists, written as lists of elements in parentheses. Programmers build a complete program by defining their own statements (actually functions) in terms of those previously defined.

For example, a function that computes the factorial of X is:

(DEFUN FACTORIAL (X)
 (IF (= X0)
   1
     (* FACTORIAL(-X 1))))

Translating into English: “This is the definition of a function called FACTORIAL whose parameter is X. If X is zero, its factorial is 1; otherwise, its factorial is equal to X times the factorial of X – 1.” The IF keyword works like a Pascal if-then-else statement. This function calls itself recursively; recursion is a normal way of expressing repetition in Lisp.

Share it: CITE

Related Definitions