Introduction to LISP

36
Introduction to LISP Based on slides by Milos Hauskrecht

description

Introduction to LISP. Based on slides by Milos Hauskrecht. 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 - PowerPoint PPT Presentation

Transcript of Introduction to LISP

Page 1: Introduction to LISP

Introduction to LISP

Based on slides by Milos Hauskrecht

Page 2: Introduction to LISP

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

LISP language

3

Page 4: Introduction to LISP

Syntax

4

Page 5: Introduction to LISP

Data types

5

Page 6: Introduction to LISP

Symbol and value

6

Page 7: Introduction to LISP

Lists

7

Page 8: Introduction to LISP

Lists

8

Page 9: Introduction to LISP

List construction

9

Page 10: Introduction to LISP

Lisp copying

10

Page 11: Introduction to LISP

Evaluation rules

11

Page 12: Introduction to LISP

Useful functions

12

Page 13: Introduction to LISP

LISP TutorialProblem-Solving by Searching

13

Page 14: Introduction to LISP

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

Function definition

15

Page 16: Introduction to LISP

Function definition

16

Page 17: Introduction to LISP

Conditional statement

17

Page 18: Introduction to LISP

If statement

18

Page 19: Introduction to LISP

Equality

19

Page 20: Introduction to LISP

Equality

20

Page 21: Introduction to LISP

Nil

21

Page 22: Introduction to LISP

Logical operators

22

Page 23: Introduction to LISP

Recursion

23

Page 24: Introduction to LISP

Recursion

24

Page 25: Introduction to LISP

Local and global variables

25

Page 26: Introduction to LISP

Local variables

26

1

Page 27: Introduction to LISP

Local variables

27

Page 28: Introduction to LISP

More on functions

28

Page 29: Introduction to LISP

Optional parameters

29

Page 30: Introduction to LISP

Array

30

Page 31: Introduction to LISP

Iterations

31

Page 32: Introduction to LISP

loop

32

Page 33: Introduction to LISP

dolist

33

Page 34: Introduction to LISP

do

34

Page 35: Introduction to LISP

do*

35

Page 36: Introduction to LISP

Program call

36