Homework Requirements
This document outlines the rules you should follow when submitting a homework assignment for grading. These rules will simplify the grader's job by standardizing the form and appearance of submissions. Any of these rules can be overridden by a particular assignment but, if the assignment doesn't say otherwise, follow each of them.
Forms of Submission
When you are asked to submit a set of files, you will be required to submit them in one or two forms: electronically and (rarely) hard copy.
-
electronic submissions
- Log in to the submission system using your CatID username and password. The page will open in a new tab.
- Select CS 3540 from the course menu.
- Select the desired assignment from the menu.
- Follow the instructions to upload the required files and, if allowed for that assignment, any optional files.
- Review the Uploading the following files page to be sure that your files were uploaded.
-
hardcopy submissions I will rarely ask you to
submit a print-out of a file from an assignment. When I do:
- Print a hard copy of the file specified by the assignment. You don't need to submit other files.
- Staple the pages.
- Bring the hardcopy to your next class period.
Documentation
-
Document each Racket source file with a header block that
includes the file's name, your name, the name of the file's
original creator (if not you), and a modification history that
lists the date of each change to the file and the change made.
Here's an example:;; ;; FILE: factorial-aps.rkt ;; AUTHOR: Eugene Wallingford ;; DATE: 2016/01/31 ;; COMMENT: Uses accumulator passing style to demonstrate ;; efficient function calls. ;; ;; MODIFIED: 2016/03/08 by Eugene Wallingford ;; CHANGE: Fixed base case to handle negative arguments ;;
Your block need not look exactly like this, but it should contain the same information. - Use comments to indicate where the code for each problem begins and ends.
Source Code
-
Any Racket source files that you submit should be loadable and
executable by Dr. Racket.
We should be able to open a source file in the IDE, hit theRun
button, and begin using your functions.
This means that your functions must be syntactically correct and that any non-Racket text in the file must be in comments. -
Place any
check-equal?
tests for a problem after the code for your solution. Unless otherwise specified in the assignment, you should have at least threecheck-equal?
expressions for each problem. - Put any helper functions you write for a problem between the main function in your solution and the tests for the main function.
Style
I do not require you to follow a lot of specific style rules, but I do ask you to follow several basic guidelines to improve the readability of your code.
-
Indent your code in the standard Racket way.
Racket's style indicates that one expression is subordinate to another. This is essential when programming in Racket. For example, write this:(define factorial (lambda (n) (letrec ((accumulate (lambda (n answer) (if (zero? n) answer (accumulate (- n 1) (* n answer)))))) (accumulate n 1))))
not this:(define factorial (lambda (n) (letrec ((accumulate (lambda (n answer) (if (zero? n) answer (accumulate (- n 1) (* n answer)))))) (accumulate n 1))))
You will see proper style in all the code I give and in all the code you see in our course reading. Learn from these examples.
When you use Dr. Racket, it will indent your code in the standard way. If your indentation ever gets out of whack, you can use the "Reindent" or "Reindent All" options on the Racket menu to re-indent your code. -
Use names that say what they name.
For example,num-scores
is a better name thann
, andnumber-of-scores
is better yet.
Racket lets you use names that say just about anything you need to say. Take advantage of that! If you have a list of the numbers from 4 to 10, name it4-to-10
. If a procedure converts characters to pairs, name itchar->pair
. -
Use hyphens to create compound names.
Racket symbols are case-sensitive, but it comes from a culture in which names are case-insensitive. Do not useCamelCase
orsnake_case
for your function and parameter names. Instead ofnumberOfScores
as you might in Java ornumber_of_scores
as you might in Python, usenumber-of-scores
instead.