SICP Exercise 2.52 modified square-limit

Exercise 2.52.  Make changes to the square limit of wave shown in figure 2.9 by working at each of the levels described above. In particular:

a.  Add some segments to the primitive wave painter of exercise  2.49 (to add a smile, for example).
b.  Change the pattern constructed by corner-split (for example, by using only one copy of the up-split and right-split images instead of two).

c.  Modify the version of square-limit that uses square-of-four so as to assemble the corners in a different pattern. (For example, you might make the big Mr. Rogers look outward from each corner of the square.)

SOLUTION

The code and tests are here.

In this exercise, I have used the procedures from 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