What to turn in for Programs

     -- by Michael Bogomolny

When turning in your programs, you should turn in not only the program definitions but also some interactions showing that you tested your programs. To test your functions, you should try running the functions on some simple cases, cases that you can check in your head to make sure they are correct. If you are writing a recursive function, you should be sure to test each of the base cases as well as several of the recursive cases. After you are convinced that your function is correct, try running it on some input that you can't readily calculate in your head.

To print out your interactions, you may choose the option Save Interactions as Text from the File menu, and then print that file from some text processing program such as Word or Notepad. There is also an option under the File menu labelled Print Interactions..., but many people have had difficulty using this option, at least in previous versions of DrScheme. Here are two sample turnins. Note that the one on the right uses a function to help test the program, so that the test expressions don't need to be typed in every time. (The function turnin is provided in initdr.scm.)


(load "initdr.scm")

(define (square x)
  (* x x))

(define (fact x)
  (if (= x 0)
      1
      (* x (fact (- x 1)))))


Welcome to DrScheme, version 101.
Language: Graphical Full Scheme (MrEd).
> (square 2)
4
> (square 4)
16
> (square 34)
1156
> (fact 0)
1
> (fact 1)
1
> (fact 3)
6
> (fact 10)
3628800
> 

(load "initdr.scm")

(define (square x)
  (* x x))

(define (fact x)
  (if (= x 0)
      1
      (* x (fact (- x 1)))))

(define (test-square)
  (turnin '((square 2)
            (square 4)
            (square 34))))

(define (test-fact)
  (turnin '((fact 0)
            (fact 1)
            (fact 3)
            (fact 10))))

(define (turnin-all)
  (test-square)
  (test-fact))


Welcome to DrScheme, version 101.
Language: Graphical Full Scheme (MrEd).
> (turnin-all)

> (square 2)
4

> (square 4)
16

> (square 34)
1156

Your TA prefers that you interleave your program and your interactions on the paper you hand in. This can be done by taking your finished program and pasting it into a word processor, and then cutting and pasting interactions from DrScheme into that file.

If you want to put tests of your functions directly into your program, don't. It ends up looking like the following, and it is simply too much work for the grader to associate which output goes with which test expression.


THE FOLLOWING IS A SAMPLE UNACCEPTABLE HOMEWORK STYLE:


(load "initdr.scm")

(define (double x)
  (* x 2))

(double 5)
(double 412)

(define (square x)
  (* x x))

(square 2)
(square 34)

(define (fact x)
  (if (= x 0)
      1
      (* x (fact (- x 1)))))

(fact 0)
(fact 1)
(fact 3)
(fact 10)


Welcome to DrScheme, version 101.
Language: Graphical Full Scheme (MrEd).
10
824
4
1156
1
1
6
3628800
> 

Instead of the above, use turnin. (See other side.) It saves you from a lot of typing, and can be used to prepare your final output as well.

I would also like to remind you that forging output, i.e. changing output so that it shows something other than what your function returns, is considered cheating and is punishable by an F in the course.

The highest grade you can get on an assignment without output is a D. If you do not turn in output for a given function, your function will be assumed incorrect and not be graded. If your function doesn't work, show what error message DrScheme gives you when you try to run it if you want to get any partial credit for the function.