Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE (c) S. Tanimoto, 2002 Introducing Lisp

Similar presentations


Presentation on theme: "CSE (c) S. Tanimoto, 2002 Introducing Lisp"— Presentation transcript:

1 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
Introducing Lisp The dominant programming language for experimental AI systems Lisp strengths: Interactive Supports symbolic computation Programs and data share a common representation Automatic management of memory Simple syntax Multiparadigm (functional, imperative, object-oriented) Supported by a long history and wide literature Also used as an internal scripting language for Gnu Emacs, Autocad, and other packages. CSE (c) S. Tanimoto, Introducing Lisp

2 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
LISP = LISt Processing Intended for processing symbolic information Implementations from noncommercial sites: GNU Common Lisp (GCL) - U of Texas mods to Kyoto Common Lisp CLISP -- developed in Germany. Available implementations from Allegro Common Lisp for Windows, Web edition. Allegro Common Lisp for Linux CSE (c) S. Tanimoto, Introducing Lisp

3 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
LISP: Our Objectives Motivation and History Interactive programming Functional programming List manipulation with recursive functions Language extensibility via macro definitions Language evolution to support multiple paradigms Lisp look and feel Lisp for rapidly prototyping AI systems Lisp on the Web CSE (c) S. Tanimoto, Introducing Lisp

4 History of Lisp (continued)
John McCarthy, developed the ideas during the Dartmouth Summer Research Project on Artificial Intelligence, 1956. First implementation on the IBM 704 John McCarthy published “Recursive functions of symbolic expressions and their computation by machine” in Communications of the Association for Computing Machinery in 1960. CSE (c) S. Tanimoto, Introducing Lisp

5 History of Lisp (continued)
1970s: advanced dialects -- MacLisp, InterLisp; Lisp machines (Symbolics, Inc.; Lisp Machines, Inc.; Xerox; Texas Instruments) Late 1970s: Scheme, Portable Standard Lisp, XLISP. 1984. Common Lisp. Use of Lisp as internal scripting languages: Gnu Emacs, AutoCAD. 1987 CLOS = Common Lisp Object System. 1994 ANSI Standard Lisp. CSE (c) S. Tanimoto, Introducing Lisp

6 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
Interacting with Lisp Interaction takes place in a Lisp Listener Window. Lisp runs an endless loop for interacting with the user: READ EVAL PRINT CSE (c) S. Tanimoto, Introducing Lisp

7 Interacting with Lisp (continued)
> (+ 3 5) 8 > (* 2.5 (+ 2 2)) 10.0 > (setq x 5) 5 > (sqrt x) > (* x x) 25 CSE (c) S. Tanimoto, Introducing Lisp

8 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
Defining a function > (* 5 5 5) 125 > (defun cube (n) (* n n n)) CUBE > (cube 2) 8 > (cube ) CSE (c) S. Tanimoto, Introducing Lisp

9 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
Symbolic Values Symbols are like identifiers, but they are commonly used as values as well as variables. > (setq x ’pizza) PIZZA > x > (setq pizza ’pepperoni) PEPPERONI > pizza > (eval x) CSE (c) S. Tanimoto, Introducing Lisp

10 More on Evaluation of Symbols
> (setq x ’y) Y > (setq y ’z) Z > (setq z ’x) X > x > (eval x) > (eval (eval x)) CSE (c) S. Tanimoto, Introducing Lisp

11 CSE 415 -- (c) S. Tanimoto, 2002 Introducing Lisp
Values of Symbols A symbol without a value in the current context is said to be “unbound”. The value of a symbol can be any Lisp object, including a number, another symbol, a functional object, a list, and array, etc. A symbol can have several local (“lexical”) values and one global value. However, symbols belong to “packages”, and two different packages can have symbols with the same name. CSE (c) S. Tanimoto, Introducing Lisp


Download ppt "CSE (c) S. Tanimoto, 2002 Introducing Lisp"

Similar presentations


Ads by Google