Functional Problem Solving (CSC 151 2015F) : EBoards

CSC151.01 2015F, Class 34: Iteration


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Regular Peer Support

Upcoming Peer Support

Other Good Stuff to Do

Questions

For part D, I want to share a really good hint with my classmates. Is that okay?

Yes.

For part A2, if we vary the length of the line, what should we keep constant?

The angle.

For part A2, can we allow the user to supply other parameters?

You may allow the user to supply other parameters, or you can choose them yourself. The kernel can also keep track of more things. (E.g., the current red, green, and blue component).

For part A2, what is systematic but not constant?

Examples: Separate by 0, 1, 2, 3, 4, 5, 6, 7, ...; - gives 0, 1, 3, 6, 10, 15, 21, ...; Separate by 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, ....

For part D, what do you expect in terms of what it should do?

A procedure that takes some information about where the recursive part should go and what size it is (and what angle it is).

When we have two choices and want to do multiple things in each case, what should we use?

You can't use an if, because it requires only one thing. You can't use a when, because you have two choices. Hence, use a cond.

    (cond
      [(test?)
       (thing1)
       (thing2)
       (thing3)]
      [else
       (cat)
       (hat)
       (bat)])

Or the following thing that CC would never write. The cond is prettier.

    (if (test?)
        (let ()
          (thing1)
          (thing2)
          (thing3))
        (let ()
          (cat)
          (hat)
          (bat)))

For the recursive image, should we assume that the entire image is being recursed or only sections.

It's much harder if you aren't keeping the whole image. So you can try it, but it will be difficult.

Contrasting map, for-each, repeat, and recursion

map:

for-each:

repeat:

recursion:

Lab

Try using the brush "2. Hardness 100" with a size of 0.25 or so.

(turtle-set-brush! turtle "2. Hardness 100" 0.25)

Writeup 1c