-
23
pages
-
English
-
Documents
Description
CS 2740 Knowledge RepresentationLecture 2Introduction to LISP Milos Hauskrechtmilos@cs.pitt.edu5329 Sennott SquareM. HauskrechtCS 2740 Knowledge RepresentationLISP languageLISP: LISt Processing language• An AI language developed in 1958 (J. McCarthy at MIT)• Special focus on symbolic processing and symbol manipulation– Linked list structures– Also programs, functions are represented as lists• At one point special LISP computers with basic LISP functions implemented directly on hardware were available (Symbolics Inc., 80s)LISP today:• Many AI programs now are written in C,C++, Java– List manipulation libraries are availableM. HauskrechtCS 2740 Knowledge Representation1LISP languageLISP Competitors:• Prolog, Python • but LISP keeps its dominance among high level (AI) programming languagesCurrent LISP:• Common Lisp• Scheme are the most widely-known general-purpose Lisp dialectsCommon LISP:• Interpreter and compiler• CLOS: object oriented programmingM. HauskrechtCS 2740 Knowledge RepresentationLISP tutorialSyntax:• Prefix notation– Operator first, arguments follow– E.g. (+ 3 2) adds 3 and 2A lot of parentheses• These define lists and also programs• Examples: – (a b c d) is a list of 4 elements (atoms) a,b,c,d– (defun factorial (num)(cond ((<= num 0) 1)(t (* (factorial (- num 1)) num))))M. HauskrechtCS 2740 Knowledge Representation2LISP tutorial: data typesBasic data types: • Symbols– a– john– 34• Lists– ...
-
Publié par
-
Langue
English