lisp by namtap tapchareon 49540511. lisp background lisp was developed by john mccarthy in 1958. ...

10
Lisp by Namtap Tapchareon 49540511

Upload: emery-green

Post on 24-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Lisp

byNamtap Tapchareon49540511

Page 2: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Lisp Background

Lisp was developed by John McCarthy in 1958.

Lisp is derives from List Processing La nguage.

The first version of Lisp is called “Pure Lisp”.

Page 3: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Description of Lisp

Lisp is a functional programming language.

Lisp is the second-oldest high-level programming language.

Page 4: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Descendants of Lisp

Two dialects of LISP are now commonly used are Scheme and Common Lisp

Page 5: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Scheme

Scheme is suited to educational application such as courses in functional programming and general introductions to programming

Page 6: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Common Lisp

Common Lisp was created in an effort to combined the features of several dialects of Lisp.

Page 7: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Language Structure

Lisp has only two kinds of data structure : atoms and lists .

Atoms are either symbols, which have the form of identifiers or numeric literals .

Lists are specified by delimiting their elements with parentheses .

Page 8: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Syntax Lisp's syntax is a model of

simplicity.Program and data have exactly the same form : parenthesized lists .

For example  : ( A B C D )

When interpreted as data, it is a list of four elements . When viewed as code, it is the application of the function named A to the three parameters B C and D .

Page 9: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Examples The following code defines a Lisp predicate function that

take two lists as arguments and returns true if the two lists are equal, and NIL (false ) otherwise .

( DEFUN equal_lists ( lis1 lis2 ) ( COND

( ( ATOM lis1 ) ( EQ lis1 lis2 ) ) ( ( ATOM lis2 ) NIL ) ( ( equal_lists ( CAR lis1 ) ( CAR lis2 ) )

( equal_lists ( CDR lis1 ) ( CDR lis2 ) ) ) ( T NIL )

) )

Page 10: Lisp by Namtap Tapchareon 49540511. Lisp Background  Lisp was developed by John McCarthy in 1958.  Lisp is derives from List Processing Language

Resources

Concepts of Programming Languagesseventh edition by Robert W. Sebesta

http://en.wikipedia.org/wiki/Lisp_programming_language