Problem Set 2

The goal of this problem set is to help you design functions
that deal with arbitrarily large data.

Drill:

HtDP: 9.5.4, 9.5.6, 10.1.7, 10.2.2, 10.2.3, 12.4 (large!)

Required Problems:

Note: You may use DrScheme's HtDP Beginning Student
Language (with list abbreviations) to solve the problems. If you are
comfortable with using Intermediate Student Language (ISL) and facing the
pitfalls that come with it, you are welcome to switch.

Design a program total-wage that computes the total wages
a company pays in a single pay period from a list of wage records:

Design the function image, which maps a RD to
an Image. Your function should represent each layer of dress
via a box that is larger than the representation of the inner RD
and that is labeled with an appropriate text.

Design a program that renders an Expr as an image:

(define-struct pls (x in?))
;; Expr is (make-pls 2LON Boolean)
;; interp. a pls struct represents an addition expression;
;; the boolean flag indicates whether it is an infix or
;; a prefix expression.
;; 2LON is one of:
;; -- (cons Number (cons Number empty))
;; -- (cons Number 2LON)
;; interp. a 2LON is a list with at least two numbers

Hint 1: The design guideline suggests the use of two distinct functions when
applied to the data definition. Why? Hint 2: This problem is related to
problem 1.3; re-read this problem for additional specifications.

Project: Re-design the editor from problem 1.4, but use a
list-of-strings data representation for the state of the editor instead of
the string-based one. Discuss the design trade-off in a paragraph of 20 to
30 words. (We will deduct points for each word in excess of 30.)