Programming Environment for AI Courses


Last modified: "January 13, 1997 20:05:53 by matt"

Obtaining Your Very Own Lisp

Of course, you are welcome to make use of the departmental facilities for your programming assignments, including Lisp. If, however, you are interested in obtaining a version of Lisp to run on your home computer, I suggest you look over section of the Common Lisp FAQ pertaining to free implementations of Common Lisp. For PC users, Franz's Allegro CL would seem to be a good bet. (A copy of the executable, split into 4 zip files is here.)The freeware version of the program is limited, but should suffice for our class. If you've got the dollars, you can upgrade to a full implementation. Another alternative that a lot of folks have had success with is to run Gnu Common Lisp on Linux.

For Macintosh users, the best shareware version of Lisp is PowerLisp. If you can afford the $135, I heartily recommend Digitool's Macintosh Common Lisp. It is the best implementation of Lisp I have seen anywhere, bar none. The commercial releases of both Allegro CL and MCL are full application development environments: debuggers, compilers, GUI construction kits, etc.


Emacs is Number One!

I recommend using emacs19 to do your programming. Forget that ancient and obsolete VI stuff! Emacs is the happening place! To run emacs19 just use the 'emacs19' command in the departmental Unix environment. (When not working in an X windowing environment, run version 18 of emacs, via the 'emacs' command.)

Learning emacs

Emacs is the world's most powerful editor, but this comes at a price: Emacs has a steep learning curve. I have been using emacs for 13 years, and pick new stuff up all the time. Still, you only need to know a little about the editor to use it. You will pick up more powerful features as you become more comfortable with the editor. There are four good ways to learn about emacs:

  1. Run the emacs tutorial. To do this, use the Help menu, or just type C-h t.
  2. Check out Keith Waclena's Web-based emacs tutorial.
  3. Use emacs' built-in Info facility. C-h i. Use the middle mouse-button to select topics.
  4. Ask other emacs users. If you see somebody doing something neat, ask them how they do it.

Modifications to Emacs for Common Lisp

There are a couple of modifications you should make to your emacs environment to make it Common Lisp friendly: Put the following code in your .emacs file (before fiddling with your .emacs files, always make a copy someplace safe, in case something goes wrong):

(defvar emacs-is-version-19 (>= (string-to-int (substring emacs-version 0 2)) 19)) (if emacs-is-version-19 (progn (load "completion") ;Turn on completion mode (initialize-completions))) ;This defines M-Ret as complet. (cond (window-system (setq hilit-mode-enable-list '(not text-mode) ;Enables hilighting in all modes except text hilit-background-mode 'light hilit-inhibit-hooks nil hilit-inhibit-rebinding nil) (require 'hilit19) )) (defun my-lisp-mode-hook-fun () (set-fill-column 110) (setq comment-column 48)) ;;; This shell-strip stuff removes the "^M" which would otherwise appear at the end of ;;; every line of output in any shell buffer, including inferior-lisp buffers. (defun my-comint-mode-hook () (require 'shell) (cond ((not (member 'shell-strip-ctrl-m comint-output-filter-functions)) (setq comint-output-filter-functions (cons 'shell-strip-ctrl-m comint-output-filter-functions))))) (if (boundp 'comint-mode-hook) (if (listp comint-mode-hook) (if (not (member 'my-comint-mode-hook comint-output-filter-functions)) (setq comint-mode-hook (append comint-mode-hook '(my-comint-mode-hook)))) (setq comint-mode-hook (list comint-mode-hook 'my-comint-mode-hook))) (setq comint-mode-hook (list 'my-comint-mode-hook))) (if (boundp 'lisp-mode-hook) (if (listp lisp-mode-hook) (if (not (member 'my-lisp-mode-hook-fun lisp-mode-hook)) (setq lisp-mode-hook (append lisp-mode-hook '(my-lisp-mode-hook-fun)))) (setq lisp-mode-hook (list lisp-mode-hook 'my-lisp-mode-hook-fun))) (setq lisp-mode-hook (list 'my-lisp-mode-hook-fun))) Okay, with the above code in place, you should be able to run Lisp from within emacs. Use the command A separate buffer should spring up with Lisp running inside it. You can type directly into this window and it should be just like working in an xterm, but better. Improvements include: For a complete list of the commands within the Inferior Lisp environment (as it called,) type C-h m within the inferior lisp buffer.