12.6 Placement 3
On this page:
12.6.1 Language
12.6.2 Library
12.6.3 Reading
12.6.4 Task
12.6.5 Grading Standards
12.6.6 Turnin

12.6 Placement 3

12.6.1 Language

For the following assignment, you must use Racket’s Beginning Student with List Abbreviations language. Go to the Language menu, select Choose Language, and pick the language from the Teaching Languages section.

12.6.2 Library

In Placement 2 you defined the function is-in?. This is built into Racket with the name member. You may use member from now on. Note that member uses equal? to perform its comparisons.

We will also be using characters, which are the atomic elements of strings. Characters are written with a #\ prefix: e.g., #\c, #\s. You can turn strings into lists of characters and vice versa using string->list and vice versa with list->string.

From now on, for the rest of the placement and the course: in every assignment, you can use any functions defined in that and any previous assignment, as well as libraries permitted in that and previous assignments, unless indicated otherwise—but no other. There may well be built-in functions that do exactly what the assignment asks for, but unless the assignment is expressly about your ability to search, we want you to demonstrate to us that you can write it with the resources we’ve asked you to use.

Some functions in this assignment would benefit from creating a helper function to handle a complex sub-task.

12.6.3 Reading

Read Part 2 of HtDP 2/e, specifically chapter 10.1. You can read past it if you feel the need as you’re doing the assignment.

If you find something unfamiliar, recall that we skipped reading Part 1 so you may need to peek in there to look up something.

12.6.4 Task

Define the following functions.

12.6.5 Grading Standards

From this assignment onward, for the rest of the placement and the course, you will be graded on both the quality and correctness of your code and on the quality and correctness of your tests. Both are important. If you didn’t pay enough attention to writing tests earlier, you should certainly start doing so now.

12.6.6 Turnin

From now on, for the rest of placement and most of the semester, you will turn in two files.

One file, named p3-code.rkt, contains the five functions named above (it can contain any other helper definitions you like as well). The functions must be named exactly as above and must take parameters exactly as above. (Note: Google Drive will automatically rename your file(s) to include your name. This is fine.)

In addition, make a copy of just the test cases for the required functions and put them in another file, p3-tests.rkt. Turn this in as well. We will grade the quality of your tests by running your tests against our implementations. Therefore, this file should:
  • not contain implementations of any of the required homework functions (otherwise Racket will not know which implementation to run)—therefore, you will not be able to run this file on its own

  • not contain tests for any helper functions (we may not have written the same helpers, in which case your tests will fail)

  • contain any other definitions needed to run your tests (e.g., if you define a variable and refer to that variable in several tests, we need that definition, otherwise the tests will error)—excluding, of course, the implementation of the required homework functions, which we will be providing

Observe that we are not asking you to modify p3-code.rkt. Leave your helpers, tests, etc. intact in there.

Failure to follow any of these instructions may result in zero credit.

Upload your files here. You will need to be logged into the Google@Brown domain to upload.