CSCI 301 L00 Worksheet

Lecture 0 - Exercises

Part N - Team Norms

  1. Take two minutes to think about group work experiences you’ve had in the past (in this class or otherwise). Consider:

  2. Take five minutes with your team to:

    Write your norms on the Team Norms sheet. I’ll collect these after class and redistribute them with the Exercise/Problem sheets each day. We’ll occasionally revisit norms and make adjustments as necessary.

Part A - 0 to lambda

  1. Recall that the formula for the volume of a sphere is \(\frac{4}{3}\pi r^3\). Racket has a built-in function expt to calculate exponents; its two arguments are the base and the exponent. Racket also has a built-in variable pi containing the (approximate) value of \(\pi\). Define a function that takes one argument, radius, and compute the volume of a sphere with that radius.

Part B - Lexical Scope

  1. Write a function plus-root to compute one root (the one resulting from the + of the \(\pm\)) of the quadratic formula. (reproduced below, in case you don’t presently have it memorized). Use let (or let*) to help you make it as readable as possible.

    \[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

    Here’s a couple test cases in case you try it out:

    (plus-root 0.5 -3 2.5)
    5.0
    (plus-root 0.5 -3 5)
    3.0+1.0i