Downloading and Installing Lisp Code for AIMA

This page gives instructions for retrieving the code for the book, and installing it on your local system. This installation procedure need only be followed once. If you are using the book in a course, your instructor (or an assistant) will probably do this for you, and you can move on to using the code.

Downloading the Code

To download the code, follow these steps:
  1. Create a directory where you want the code to reside, and change to that directory. On Unix, this might be "mkdir aima; cd aima".
  2. Download the source code. The easiest way is to click on this link to get code.tar (973KB). If you are on a very slow connection to the Internet, you can get code.tar.gz (188KB) instead and then on Unix do gunzip code.tar.gz or on Windows drag the file to the WinZip icon, or similar archiving tool (e.g. PKunzip). Make sure you download the file to the correct directory (in most browsers, this is done by clicking the right mouse button and choosing the "save as file" option).
  3. Execute the command tar xf code.tar to unpack the archive of files. (Or drag the code.tar file to a program such as WinZip, Stuffit Expander or PKunzip.)

Installing a Lisp Interpreter/Compiler

There are many available Lisp compilers that you can use. We have tested the code and know it works on the following: Both of these products are available in a no-cost demo version and a more powerful commercial version. You should be able to do the exercises in the book with the demo versions. So if you are about to install a Lisp, we recommend one of these. If you already have a Lisp installed, chances are you can get the code to run, but you may have to make some minor changes.

Installing the Code

  1. Make sure you have both read-permission and write-permission for the directory where the code is kept.

  2. Edit the file "aima.lisp" and change the value of the parameter *aima-root* on line 9 to reflect the location of the files. Make sure to use the proper syntax for a directory, not a regular file. For example, on a Unix file system, you want something like "/usr/local/aima/", or "/home/yourname/aima/", where the final "/" indicates that /usr/local/aima is a directory. For a Windows file system, you'd have something like "c:\\aima\\". Note that you have to use double backslashes, because backslashes are treated specially in Common Lisp strings. In most versions of Windows you can also use forward slashes: "c:/aima/", but check to see if this works on your system before you try it. For most installations, this will be the only edit you need to make.

  3. For some unusual Lisp compilers, you may need to edit the parameter *aima-binary-type* to indicate the type of files created by your Lisp compiler. If the compiler creates files of the form "name.bin", then set this parameter to "bin". Do include the double-quote marks.

  4. Start up your Common Lisp, and enter the following four forms:
        (load "aima.lisp")
        (aima-load 'all)
        (test 'all)
    The compiler will compile all the files, and the test mechanism will test the resulting code. Look for "0 errors" in the output and a 0 as the return value.

  5. Most versions of Lisp provide a way to dump out an image -- an executable file that contains all the code that has been loaded so far. If your Lisp has this feature, it might be a good idea to create such an image at this point, and save it for later use.

Running the Code

The steps above need be done only once; you are now ready for the easier process of using the code.

AIMA Home Contact Russell & Norvig What's new Changed 3/13/97