Submission Instructions

How to submit

Please submit your assignment by emailing it to me at a special address, jesse.tov+mpX at gmail dot com, where X is the number of the assignment you are submitting. (E.g., for Machine Problems 1, it should be mp1.)

You should include any necessary files as attachments. For MP1, this will probably include:

mp1.scm
Solutions to programming problems
top.scm
Tests for programming problems
diary.txt
Your development diary (as a plain text file)

For non-programming questions, I would prefer that you write answers as comments in the main programming file (e.g., mp1.scm). If you feel that ASCII text is insufficient, please send a PDF, or if you want to do it on paper, please give it to Prof. Lieberherr in class. I can't easily accept proprietary formats such as MS Word, so I'd prefer that you not use those.

Modules and tests

Your programming solutions should generally be written in a file named mpX.scm, in a module named mpX (where X is the assignment number); more specific instructions accompany each assignment. To do this, you should choose the (module ...) language in DrScheme. For example, in MP1, your code should look like this:

   (module mp1 (lib "eopl.ss" "eopl")
     (require "drscheme-init.scm")
     (provide flatten up down) ;; Etc.

     ;; Your definitions here
   )

Make sure you save drscheme-init.scm in the same directory with your other Scheme source files. You'll also need to use the provide form to export all the main functions you have written (and any other functions you need to test).

For MP1, your test module will then look something like this:

   (module top (lib "eopl.ss" "eopl")
     (require "drscheme-init.scm")
     (require "mp1.scm") ;; Import the functions

     ;; Your tests here
   )

There is a function run-tests! that you should use to write tests. To test a function, for example flatten, you would write:

   (run-tests! flatten equal?
     '((trivial () ())
       (already-flat (a b c) (a b c))
       (one-level ((a b) (c d)) (a b c d))))

Where it says flatten is where you put the name of the function you want to test. Next, equal? is the name of the comparator to check whether the expected value matches the actual value. (When would you use something other than equal??) Finally, you have a list of test cases, where each test case has three things in it:

   (name argument result)
Name is just a name to identify the test case, argument is an argument to pass the function, and result is the correct result. When you run your testing module, it will try the function on each module, and tell you when the results match and when they don't.

You may also find useful an alternate approach to testing.