Your goal in this assignment is to set up the Lisp environment you'll be using for the rest of this class.
If you have no preference about Lisp's, install Allegro Common Lisp. It's available at Franz, Inc.. This will be the Lisp that most students will be using, so you'll get the best local support if you run into trouble.
Allegro comes with two versions: ANSI, which implements the Common Lisp standard, and Modern, which implements a non-standard version compatible with Java libraries. Each version can be run with or without the Integrated Development Environment (IDE). If you use Allegro, be sure to use an ANSI image. I recommend the ANSI IDE. You will get errors with standard third-party libraries if you use a Modern image.
You can use any other Common Lisp that is listed as supported by the portable AllegroServe library for Lisp-based web services.
Scheme is not suitable for this course.
Before doing anything else, try starting Lisp, as appropriate for the platform you're on and the Lisp you installed. In Windows, you can start Allegro Common Lisp from the Start menu.
Type a few simple expressions, e.g., (* 23 45),
just to make sure everything is working.
If you have problems, ask for help.
Make a CS 325 directory, e.g., in Windows, it might be
c:\cs325.
Download cs325.zip. Unzip the contents of that file into your CS325 directory.
Start your Lisp and load the file
cs325.lisp. This
file is included in
cs325.zip.
If your Lisp has a visual interface, there will be a menu item under File for loading files. Otherwise, use
(load "c:/cs325/cs325.lisp")
replacing c:/cs325/cs325.lisp with whatever location
you extracted the CS 325 files to.
Note: When specifying pathnames in strings, use "/" as the directory separator, not "\". Lisp, Java, and C++ all recognize "/" as a directory separator, whether you're running on Windows, Unix, or MacOS. "\" on the other hand is only valid for Windows pathnames, and, because it is used in Lisp, Java and C++ to mark special characters, you have to write "\\". So, keep it simple -- use "/".
If you get any error messages, see below for how to get help.
If everything seems to load OK, type:
(in-package :cs325-user)
followed by a carriage return. In Allegro, the prompt should now indicate that you're in CS325-USER.
Type:
(critique (defun foo (x) (setq x (+ x 1))))
If all has been set up correctly, the above should cause several critiques of the above code to appear.
Then type
(get-tests)
A list of several lines long of about 60 names should be returned.
If any of the above tests does something unexpected, ask for help.
The Lisp Critic runs orders of magnitude faster when compiled. In Allegro and Lispworks, all you need to do is use the Compile and Load option in the File menu. Compile and load these two files:
extend-match.lisp which defines the pattern matcherlisp-critic.lisp which defines the Lisp CriticIn other Lisp's, you can use the Lisp function compile-file
to compile a file, then use load to load it.
You should only need to compile these files once. In the future, the code
in cs325.lisp will automatically load the compiled file. If
you modify or download extend-match.lisp or
lisp-critic.lisp, be sure to re-compile them.
Email to
c-riesbeck@northwestern.edu
If the CS325 code is working, you can tell many Lisp's to load the file automatically every time you start Lisp. These Lisp's load some initialization file every time they start. The name and location of this file varies from OS to OS and Lisp to Lisp.
I have made some sample startup files for Allegro and LispWorks. The table below summarizes where they should be placed. Whichever one you use, you must modify one line, as marked in the file, to specify where you installed the CS 325 code.
| Lisp | Operating System | Startup File | Where to Put | |
|---|---|---|---|---|
| Allegro Common Lisp | Windows | startup.cl |
Allegro directory, e.g.,C:\Program Files\acl62\startup.cl |
|
| Allegro Common Lisp | Linux | clinit.cl |
your home directory, i.e.,~/clinit.cl |
|
| LispWorks | Windows | lww-init.lisp |
your home directory, e.g.,C:\Documents and Settings\your-name\lww-init.lisp |
LispWorks Personal Edition does not automatically load any file on start up. But if you put the start up file in the directory given, it will be immediately available when you do File | Load....
If you are using some other Common Lisp, find out what file it
loads at start up time and modify it to do what
startup.cl does.
Even when cs325.lisp is loaded automatically,
you still have to type (in-package :cs325-user)
to access the CS 325 functions.
I have not found any simple way to
automatically set the user package inside cs325.lisp.
There's a lot of ways to make trivial errors in configuring any language environment, and most of them lead to fairly cryptic messages and behavior.
The best source of help will be the CS 325 news group.
Comments?
Send mail to Chris Riesbeck.
Put EECS 325 in the Subject.