SICP Exercise 2.51 below 2

Exercise 2.51.  Define the below operation for painters. Below takes two painters as arguments. The resulting painter, given a frame, draws with the first painter in the bottom of the frame and with the second painter in the top. Define belowin two different ways -- first by writing a procedure that is analogous to the beside procedure given above, and again in terms of beside and suitable rotation operations (from exercise 2.50).

SOLUTION

The code and tests are here.

In this exercise, I have used the procedures in the included package. I have used segments->painter directly from the package. I am also using transform-painter directly from the package. The same is true for vector, segment and frame. transform-painter is implemented slightly differently (see code) from what is shown in the text book. Accordingly, all other procedures like wave-painter and frame-X-painter have been modified to work with the procedures in the package.





Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions