Introduction to LISP
description
Transcript of Introduction to LISP
![Page 1: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/1.jpg)
Introduction to LISP
Based on slides by Milos Hauskrecht
![Page 2: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/2.jpg)
Install CLISP Go to http://www.gigamonkeys.com/lispbox At the bottom of the page, choose CLISP Download the appropriate package Uncompress the archive Click lispbox OR
Check class homepage for local copies (Windows only)
2
![Page 3: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/3.jpg)
LISP language
3
![Page 4: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/4.jpg)
Syntax
4
![Page 5: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/5.jpg)
Data types
5
![Page 6: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/6.jpg)
Symbol and value
6
![Page 7: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/7.jpg)
Lists
7
![Page 8: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/8.jpg)
Lists
8
![Page 9: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/9.jpg)
List construction
9
![Page 10: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/10.jpg)
Lisp copying
10
![Page 11: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/11.jpg)
Evaluation rules
11
![Page 12: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/12.jpg)
Useful functions
12
![Page 13: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/13.jpg)
LISP TutorialProblem-Solving by Searching
13
![Page 14: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/14.jpg)
Administrative
Room changed to HLTH 2008 A grader is assigned: Shahram Mohrehkesh Projects will be in groups of 2-3 students
· The contributions of each member should be stated clearly in the project report
· Members of the same group may receive different grades
14
![Page 15: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/15.jpg)
Function definition
15
![Page 16: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/16.jpg)
Function definition
16
![Page 17: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/17.jpg)
Conditional statement
17
![Page 18: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/18.jpg)
If statement
18
![Page 19: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/19.jpg)
Equality
19
![Page 20: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/20.jpg)
Equality
20
![Page 21: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/21.jpg)
Nil
21
![Page 22: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/22.jpg)
Logical operators
22
![Page 23: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/23.jpg)
Recursion
23
![Page 24: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/24.jpg)
Recursion
24
![Page 25: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/25.jpg)
Local and global variables
25
![Page 26: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/26.jpg)
Local variables
26
1
![Page 27: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/27.jpg)
Local variables
27
![Page 28: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/28.jpg)
More on functions
28
![Page 29: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/29.jpg)
Optional parameters
29
![Page 30: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/30.jpg)
Array
30
![Page 31: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/31.jpg)
Iterations
31
![Page 32: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/32.jpg)
loop
32
![Page 33: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/33.jpg)
dolist
33
![Page 34: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/34.jpg)
do
34
![Page 35: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/35.jpg)
do*
35
![Page 36: Introduction to LISP](https://reader035.fdocuments.us/reader035/viewer/2022081507/56816048550346895dcf6dc1/html5/thumbnails/36.jpg)
Program call
36