Assignment Three: Lisp Programming

Your last assignment was to create for yourself a student character on the ProgrammingLand MOO, find the Goalie, and get a Lisp assignment. There were a dozen or so individualized assignments, so 3-4 people in class have each one. These assignments look like this example:


The second assignment is to code a LISP function. To implement
this you will  only need to use simple functions.
Each student has a different function, yours is:

You are write a LISP function named COUNT-NILS which will scan a list and 
count the NIL atoms at the top level.
Here are two examples of its use:
  (count-nils '(a b))  
will produce 
  0
and
  (count-nils '(a NIL 5 (b c) NIL (NIL NIL))) 
will produce:
  2
In the second example the list (NIL NIL) contains two NILs but they are
 not at the top level.

The third assignment: 
You are write a LISP function named NIL-TO-X which will accept a list and
 produce a new list. The new list will have exactly the same shape as the old
 list but all the NILS, regardless of level, will be changed to X.
Here are two examples of its use:
  (nil-to-x '(NIL a NIL b))  
will produce 
  (X a X b)
and
  (nil-to-x '(a NIL NIL (b NIL c) d (NIL (NIL x) NIL))) 
will produce:
  (a X X (b X c) d (X (X x) X))

To turn in your work, you should create a text file with 1) your
commented code, 2) a function that runs your code on the examples
 provided in the assignment, and 3) a function named GRADER that gives
 instructions on how to load and run your functions. Mail your text file to the
 designated TA when it is complete. 

Due Midnight, Thursday, October 10, 2002, 100 points

  1. Name your file after yourself: i.e. brian.slator.lsp
  2. Include your name and NAID among the comments at the top (note: the semi-colon ";" is the comment character)
  3. Include the text of your personalized assignment in the comments at the top.
  4. Grading (100 points possible):
    • Correct output (15 points, 4 examples, 60 points)
    • Recursive solution (10 + 15, 2 functions, 25 points),
      Iterative solution (5 points, 2 functions, 10 points)
    • Style, elegance, comments, etc. (15 points)