211 F '06
The Hand In
The Recipes
The World
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
Set 7
Set 8
Set 9
Set 10
Set 11
Set 12
Set 13
Set 14

Problem Set 8

Due date: 10/31 @ 6pm

Programming Language: Intermediate Student Language

Problem 0 [5%]:

Find one interesting article from the weeks news on the use of software/computers in society. Summarize the article in your own words with a single 200-word paragraph, as a pair, one playing writer, the other playing editor. Add both the article and the summary in with the rest of your problem set.

This problem set has three goals. First, you will get to deal with data classes whose self-referential and mutually referential data definitions are close to those you find in the real world (though there they are deeply hidden in most cases). Second, you will find out how the stepper (and interpreters for languages) works. Eli Barzilay, a PLT research scientist and instructor in the College, teaches an entire course on this topic. Third, you will learn to edit programs that you have written two weeks ago, an essential skill for any programmer.

HtDP Problems:

17.7.1, 17.7.2, 17.7.3, 17.7.4

Problem A1:

Edit your UFO project according to your grader's mark ups. You may use local within existing functions, but don't rewrite the functions otherwise.

Since you have a new partner, you actually have two different homework from which you can start. You are free to choose whichever one you like best. You must turn in your marked up copy with the cover page to get any credit for this problem.

Explanation: A good "manager" will help you improve your code in this manner. So imagine we (the course staff and you) are in a start-up and we don't want to waste money with program code that is difficult or impossible to maintain. Your "manager" played "copy editor" (look it up if you don't know what this means) and you're now removing typos.

Problem A2:

Warning: This is a difficult problem.

This data definition describes a tree of symbols:

(define-struct node (name left right))
;; Tree = empty | (make-node Symbol Tree Tree)

Design a function that consumes such a tree and produces an image of the tree. The function should draw each leaf (empty) as a red bullet and each branch as the combination of two trees via a fork:

 ;; draw-fork : Number String -> Image 
 ;; produce a branching picture like this: 
 ;; |               |
 ;; +-------+-------+ 
 ;;         |
 ;; width: w; left up at 1/4 * w; 
 ;;           right up at 3/4 * w; 
 ;;           down at 1/2 * w
 ;; pinhole @ (0,0)
 (define (draw-fork w label) ...)

The left and the right tree should sit on top of the left and right branch of the fork, respectively; both should use the same width. The downward stem should be centered. Hint: Design functions that help you compose images vertically and horizontally; both should consume images whose pinhole is at (0,0).


sample tree

last updated on Thu Nov 30 11:55:15 EST 2006generated with PLT Scheme