Start of topic | Skip to actions

Assignment 2 (Due Monday 9/10/2007 before class)

Weight: 400 points.

Please review the homework style guide again. Turn in via SVN.

  • 4.2.1 (part 5)
  • 4.2.3 (part 3)
    • Your test values should include 10, 12, and 14.
  • 4.3.1
  • 4.4.1
  • 5.1.1
    • Submit your hand evaluation as a sequence of expressions, each of which is one step simpler than the previous one and evaluates (when run in DrScheme) to the same value.
    • Write the set of "examples" as tests -- that is, expressions that will run in DrScheme. You will not be able to produce 5 different examples here.
  • 5.1.5
    • You can experiment with master.ss teachpack, but you don't need to demonstrate that you have done so to receive credit.
  • 6.1.1 (part 2)
    • Submit your hand evaluation as in 5.1.1. Use the DrScheme stepper to check your work (this will be easier if you paste the expression into a fresh, empty document), but try to do the evaluation on your own first.
  • 6.3.1 (part 4)
    • Make a "box representation" by just producing something that looks more or less like a table using text. No bonus points for being fancy.
  • 6.3.2
    • Stating the "general laws" will look a lot like the previous parts of the question. You can use "<some-expression-1>", etc., to represent arbitrary expressions in order to demonstrate these "general laws."
  • 6.4.2
  • 6.5.2
    • You don't need to respond to the "explain the example" portion in your submission -- just define the function.
  • 7.1.1
    • Submit your hand evaluations as in 5.1.1. (Some of these will be quite trivial.) You will need to copy the definition of "star" from the text, but not "posn" -- it's built in.
  • 7.1.3
    • You can copy the definition of "shape" from the text. "Is it possible..." doesn't require a response.
  • 7.2.1
  • 7.5.1
    • Write examples and tests that both produce values and cause errors. Before you submit, comment out those tests that produce errors, so that your file can be run cleanly in DrScheme.
  • 7.5.3
    • Follow instructions for examples and tests from 7.5.1.

  • In the textbook you've seen the contract and definition for a 2-dimensional (2D) position. Following the design recipe, develop a notion of a 3D position and implement it with an appropriate struct definition. Do the same for a 4D position. Then define a "234-position" that encompasses all three. Develop and implement a function that computes the distances between two "234-position"s. This function can assume that the two incoming points have the same dimension. Be particularly careful about how you define the contract for the "distance" function. Next, write a "distance-from-origin" function that takes any "234-position" and returns the Euclidean distance to the origin from that point. Make sure you use the "distance" function that you have already defined in the earlier part of this exercise. Submit all intermediate results, as well as materials showing that you have followed the design recipe.

Access Permissions: (Please don't edit)


End of topic
Skip to actions | Back to top
Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.