Use the Lisp Unit Tester and the Lisp Critic functions on every exercise you submit. Both are loaded automatically into your Lisp image by the cs325 system.

Use of these tools is required. I will return unreviewed any code that has not been checked.

If you believe that one of the tools is wrong about your code, submit your code, along with the message(s) the tool gave, and your reasons for disagreeing.

Make sure you are getting notifications from Campuswire. I post announcements when any CS325 tool is updated.

The Lisp Unit Tester

The lisp-unit unit tester runs your code on a set of test cases. These test cases are defined in exercises-tests.lisp. This file is loaded automatically by the cs325 system.

There are test cases for most of the approved CS325 exercises. To see a list of the test cases that have been defined, in the CS325-user package, type:


The names of the test cases match the names of the functions they test.

To test your solution for an exercise:

See the lisp-unit documentation for more details.

The Automated Lisp Critic

The Lisp Critic scans your code for instances of bad Lisp programming practice. The Lisp Critic works for all Lisp code, even if there are no test cases. Use the Critic with all your code, whether it's an exercise, an assignment, or something you invented on your own.

There will be a few cases in later chapters where your code will have to violate them, but this happens far less often than students think. Do the best you can to reduce the number of critiques you get. If you believe the Critic is wrong, submit your code, its comments (copy and pasted, not paraphrased), and your reasons for disagreeing.

Run the Lisp Critic only after you've gotten the bugs out of your code. To use it, evaluate

(critique function-definition)

Note -- no quote! For example,

? (critique
          (defun count-a (lst)
            (setq n 0)
            (dolist (x lst)
              (if (equal x 'a)
                (setq n (+ n 1))))
    Don't use SETQ inside DOLIST to accumulate values for N.
    Use DO. Make N a DO variable and don't use SETQ etc at all.
    You have an IF with no else branch. If the return value of the IF
    matters, you should explicitly say what the else returns, e.g., NIL.
    If the return value doesn't matter, use WHEN or UNLESS.
    INCF would be simpler to add 1 to N than SETQ
    GLOBALS!! Don't use global variables, i.e., N
    Unless something special is going on, use EQL, not EQUAL.
    Don't use (+ N 1), use (1+ N) for its value or (INCF N) to change N,
    whichever is appropriate here.

To run the Lisp Critic on an entire file of code:

(critique-file pathname)

For example,

? (critique-file "~/riesbeck/cs325/chap9-exs.lisp")