next up previous
Next: 3. Programming assignment: Procedures Up: No Title Previous: 1. Getting started

2. Tutorial Exercises

Prepare these exercises for oral presentation in tutorial.

Tutorial exercise 1:

Below is a sequence of expressions. Be prepared to indicate the result that is printed by the interpreter in response to each expression. Be prepared to explain why. Assume that the sequence is to be evaluated in the order in which it is presented. (Try to determine the answers to this exercise without actually trying these on a computer.)

(> 10 9.7)

+

(define double (lambda (x) (* 2 x)))

double

(define c 4)

c

(double c)

c

(double (double (+ c 5)))

(define times-2 double)

(times-2 c)

(define d c)

(= c d)

(if (= (* c 6) (times-2 d))
    (< c d)
    (+ c d))    

(cond ((>= c 2) d)
      ((= c (- d 5)) (+ c d))
      (else (abs (- c d))))

(define try (lambda (x) (x 3)))

(try double)

(try (lambda (z) (* z z)))

Check the 6.001 discussion forum for tutorial-ex-01
Look here for information about the forum.

Tutorial exercise 2:

What is the difference between the following two ways of defining cube?

(define cube (lambda (x) (* x x x)))

(define (cube x) (* x x x))

Check the 6.001 discussion forum for tutorial-ex-02
Look here for information about the forum.

Tutorial exercise 3:

Do exercise 1.4 of the text.

Check the 6.001 discussion forum for tutorial-ex-03
Look here for information about the forum.

Tutorial exercise 4:

Do exercise 1.6 of the text.

Check the 6.001 discussion forum for tutorial-ex-04
Look here for information about the forum.


next up previous
Next: 3. Programming assignment: Procedures Up: No Title Previous: 1. Getting started

Hal Abelson
Sat Jan 31 15:55:15 EST 1998