Assignment 1: Finger Exercises


Due 01.Aug.31 (fri), at the start of class
(but will still be accepted Due 01.Sep.05 (wed), at the start of class

You may work with or without a partner on this first homework, though a partner will be needed for the next homework.

Before you tackle the homework, remind yourself of our General Advice, and Advice on Homeworks. (The Grading Guidelines won't be particularly pertinent until the next homework.)


  1. (0pts) If you didn't do so in Lab 1, run register comp210 as discussed. Also, fill out the Lab preference form [available starting tuesday morning]. instructor: see 01fall/Handouts/demographics-form.html
    If you add this course after the "check your recorded scores" notice is up on the Homework page, you must not only fill out this form, but also add yourself to the grading database, so we can record your scores. You'll get a -10% every time we can't record your score because you're not in the database.


  2. (1pt) A question has been posted on the class newsgroup, with the title "hw01 question (2001f)"; find and answer it. (Answer on your hw01 solution, not by replying to the newsgroup!)


  3. (1pt) Convert each of the following expressions into Scheme:
    1. 6 + 7
    2. 5 * (6 + 7)
    3. (4 + 9) * (8 - 7)
    4. ((4 * 4) + (3 * 3)) / 2

  4. (3pts) Convert the following function definitions into Scheme:
    1. my-square(x) = x * x
    2. avg(x, y) = (x + y) / 2
    3. celc->fahr(deg) = 9/5 * deg + 32

  5. (5pts) Evaluate each of the following expressions. Show every step, indicating on your prinout the particular (sub)expression about to be evaluated. For example:
      (sqrt (+ (* 3 3) (* 4 4)))
    = (sqrt (+ 9 (* 4 4)))
    = (sqrt (+ 9 16))
    = (sqrt 25)
    = 5
    
    You can confirm your work by typing the initial expression in DrScheme, and then using the stepper.
    1. (- (* 3 5) 20)
    2. (/ 44 (+ 8 3))
    3. (sqrt (my-square 6))
    4. (avg 6 10)
    5. (avg (sqrt (my-square (+ 4 2))) 10)
      (But when you reach a (sub)expression you've previously evaluated, you may replace (just) that subexpression with its value in one step; just mention how many steps DrScheme's stepper does, that you are doing in one fell swoop.)
    6. (celc->fahr 100)