Racket Primer

The goal of this assignment is to gain practice programming in Racket.

You are given a hw1.rkt file (on Canvas under “Files”), that contains a number of sections. In each section there are several function “stubs,” i.e. incomplete function definitions with type signatures, descriptions, and a small set of tests. Each function has a bogus (but type correct) body marked with a “TODO” comment. Your job is to replace each of these expressions with a correct implementation of the function.

Do not rename the file. Also make sure not to change the name or signature of any function given to you. You may add any additional functions that help you solve the overall problem you’re tackling.

Testing

You can test your code in several ways:

  • Running the code in DrRacket will (by default) run the test submodule and print out a report of any test failures. This is actually a configurable preference, but it is on by default.
  • Using the command line raco test hw1.rkt from the same directory as hw1.rkt.

Note that running racket hw1.rkt from the command line will not run the tests.

Submitting

Rename hw1.rkt to main.rkt. This step is important. Submit your filled-in main.rkt file on Gradescope. You can submit multiple times, but only the latest submission will be counted.

You can Cmd + F or Ctrl + F for “TODO” through your submission to find if you have any remaining tasks.

Grading

Your submission will be graded for correctness. Passing the unit tests included in the file is necessary but not sufficient to receive a perfect score. You are strongly encouraged to add your own tests to ensure the correctness of your solutions.