CSci 1301: Lab 2

The lab is done in groups of 2 or 3. In the beginning of each file please write (in comments) the names fo all group members.

What to submit

At the end of the lab please send me and your group partner(s) all your Racket files as e-mail attachments. My e-mail is elenam at morris.umn.edu. The subject of your e-mail must be "1301 Lab 2" followed by "Final" or "Not final", depending on whether this is a final submission or you are still working on it. If you need to finish it, make sure to set up a time with your group partner(s) to finish the lab.

When to submit

Due Tuesday, September 14, at 11:59pm. If you submit the final version during the lab, you are done.

Problem 1: Functions that check for intervals. (8 points)

Exercise 4.2.1, parts 2 and 4. Please follow the format in the in-class example: the contract, the purpose, examples, and tests.

Problem 2: A function with a conditional expression. (7 points)

Define a function that takes two parameters, x and y, and returns x - y if x - y is non-negative and 0 otherwise. Please use cond expression.

Problem 3: reporting errors with symbols. (7 points)

Define a function that takes two parameters, x and y, and returns the square root of x^2 - y^2 if it exists. If it cannot be computed because x^2 - y^2 is negative then return a symbol that describes the error.

Write check-expect tests for the function, make sure the tests pass.


CSci 1301 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.