This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Background and Getting Started LISP is an acronym for LISt Processor. It was developed by John McCarthy in the late 1950s, and his account of its history can be found at http://www- formal.stanford.edu/jmc/history/lisp/lisp.html . LISP found many adherents in the artificial intelligence community, and it is one of the oldest computer languages still in widespread use. There are many variants (or dialects) of LISP including Scheme, T, etc. In the 1980s there was an attempt to standardize the language. The result is Common LISP (see Guy L. Steele, Jr., Common LISP: The Language, 2nd Edition , Digital Press, 1990). Common LISP is now the most popular dialect. If you are familiar with another programming language, such as C, Pascal, or Fortran, you will be familiar with the concept of a compiler. A compiler is a program that takes a complete program written in one of these languages and turns it into a set of binary instructions that the computer can process. Unlike most languages, LISP is usually used as an interpreted language. This means that, unlike compiled languages, you start an interpreter which can process and respond directly to programs written in LISP. When you start up a LISP interpreter, a prompt will appear, something like this: > The LISP interpreter waits for you to enter a well-formed LISP expression. Once you have entered an expression, it immediately evaluates the expression entered and returns a response. For example: >(+ 1 2 3 4) 10 > In this example, the user typed the LISP expression (+ 1 2 3 4) and the interpreter responded with 10 and a new prompt. The interpreter runs what is known as a read-eval-print loop. That is, it reads what you type, evaluates it, and then prints the result, before providing another prompt. In what follows, it will be assumed that you have a LISP interpreter running in front of you. Exactly how to start LISP up will depend on the computer system you are using. If you need to, check the instructions for your LISP interpreter or ask a local person to find out how to get started. You will also need to know how to get out of the LISP interpreter. This too varies, even between implementations of Common LISP, but (quit), (exit), and (bye) are some common alternatives. Do not go any further until you know how to start up and exit LISP on your system. 1 Basic Data Types The two most important kinds of objects in LISP for you to know about are atoms and lists. These two kinds are mutually exclusive, with the exception of one special entity, the empty list, known as ``()'' or ``nil,'' which is both an atom and a list. Atoms are represented as sequences of characters of reasonable length. Lists are recursively constructed from atoms. This means that a given list may contain either atoms or other lists as members....
View Full Document
- Spring '05
- Lisp programming language