AI示例程序源代码(lisp)

来源:百度文库 编辑:神马文学网 时间:2024/04/28 16:14:27

Paradigms of AI Programming Source Code

This page is the index for the Lisp source code files for the book Paradigms of Artificial Intelligence Programming. The code is offered as open source freeware under this license. You can browse all the files in this directory.

Installation Instructions

  1. Download the file paip.zip and unzip it.
  2. You must have a lisp compiler/interpreter.
  3. To test all the code, start lisp and do the following at the interactive prompt:
    (load "auxfns.lisp")(requires "examples")(do-examples :all)
    This should print out a long list of inputs and outputs, and the last output should be the total number of errors. If all goes well, this should be "0".

Use

To use the code, edit any of the files or add new files. You will always have to do (load "auxfns.lisp") first, and you will typically have to do (requires "file"), for various instances of file that you want to use.

The function "requires" is used for a primitive form of control over what files require other files to be loaded first. If "requires" does not work properly on your system you may have to alter its definition, in the file "auxfns.lisp". For more complicated use of these files, you should follow the guidelines for organizing files explained in Chapter 24.

The function do-examples, which takes as an argument either :all or a chapter number or a list of chapter numbers, can be used to see examples of the use of various functions. For example, (do-examples 1) shows the examples from chapter 1.

The Files

The index below gives the chapter in the book, file name, and short description for each file.

CHFilenameDescription-README.htmlThis file: explanation and index-examples.lispA list of example inputs taken from the book-tutor.lispAn interpreter for running the examples24loop.lispLoad this first if your Lisp doesn't support ANSI LOOP-auxfns.lispAuxiliary functions; load this before anything else1intro.lispA few simple definitions2simple.lispRandom sentence generator (two versions)3overview.lisp14 versions of LENGTH and other examples4gps1.lispSimple version of General Problem Solver4gps.lispFinal version of General Problem Solver5eliza1.lispBasic version of Eliza program5eliza.lispEliza with more rules; different reader6patmatch.lispPattern Matching Utility6eliza-pm.lispVersion of Eliza using utilities6search.lispSearch Utility6gps-srch.lispVersion of GPS using the search utility7student.lispThe Student Program8macsyma.lispThe Macsyma Program8macsymar.lispSimplification and integration rules for Macsyma9-10 (no files; important functions in auxfns.lisp11unify.lispUnification functions11prolog1.lispFirst version of Prolog interpreter11prolog.lispFinal version of Prolog interpreter12prologc1.lispFirst version of Prolog compiler12prologc2.lispSecond version of Prolog compiler12prologc.lispFinal version of Prolog compiler12prologcp.lispPrimitives for Prolog compiler13clos.lispSome object-oriented and CLOS code14krep1.lispKnowledge Representation code: first version14krep2.lispKnowledge Representation code with conjunctions14krep.lispFinal KR code: worlds and attached functions15cmacsyma.lispEfficient Macsyma with canonical form16mycin.lispThe Emycin expert system shell16mycin-r.lispSome rules for a medical application of emycin17waltz.lispA Line-Labeling program using the Waltz algorithm18othello.lispThe Othello playing program and some strategies18othello2.lispAdditional strategies for Othello18edge-tab.lispEdge table for Iago strategy19syntax1.lispSyntactic Parser19syntax2.lispSyntactic Parser with semantics19syntax3.lispSyntactic Parser with semantics and preferences20unifgram.lispUnification Parser21grammar.lispComprehensive grammar of English21lexicon.lispSample Lexicon of English22interp1.lispScheme interpreter, including version with macros22interp2.lispA tail recurive Scheme interpreter22interp3.lispA Scheme interpreter that handles call/cc23compile1.lispSimple Scheme compiler23compile2.lispCompiler with tail recursion and primitives23compile3.lispCompiler with peephole optimizer23compopt.lispPeephole optimizers for compile3.lisp

 


Peter Norvig