Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Guidance:

    1. Follow the design recipe imitating Sample Solution to a Programming Problem .
    2. Problem 4 asks you to write a function that checks for the empty list as an input error and throws an aborting error in the case. (The purpose statement should document this behavior!) In DrRacket, the error function take a single argument not two arguments as documented in the book. We recommend using a string (text enclosed in double quotation marks) like "An empty list of toy prices triggers this aborting error". You can test the error throwing behavior of a function using check-error which is documented in the DrRacket Help Desk.
    3. Study Figure 26 in 9.4 for a detailed description of the design recipe and how it is documented in the program text that you develop.

      To follow the design recipe, you must write down the type contract, purpose, provide at least 3 well-chosen examples (more for complex functions like power), write the template for the function (trivial when no recursion is involved), write the code for the function, and include illustrative test cases for the function (using at least the examples you developed ahead of time). You should bundle the examples and test cases together as a block of check-expect invocations, which was not part of DrScheme/DrRacket when the book was written. These tests should precede your template and code.  Your chosen examples should illustrate the output you expect, and the test cases should produce the actual output (leave them uncommented). If the function processes an inductive type, make sure that your examples include the base case(s) and sample inductive cases.

...