Iterative Creation

Iterative creation refers to act of instancing multiple copies of an object (or perhaps variations of an object) to create more complex objects. This technique is applicable for creating objects made primarily from similar sub-objects.

Examples can be divided into two categories: actual objects with similar sub-components, such as keyboards, grills, buildings, and trees, and common collections of similar objects, such as forests, cities, mountains, or herds.

Source Code

Source Code


Parameterized Objects

Frequently, objects need to be instantiated differently because of changes over time, or for variety when creating copies. To make this simple, the procedure which creates the object can be given arguments which will function as parameters for that object.

For example, perhaps we would like the petals in our flower in the above example to be colors other than red. We can provide a parameter, "petal-color" to determine the color of the petals.

  (define (flower petal-color)
   (separator
    ...
    (color petal-color)
    ...
    )
   )
With a slight modification of the "flowers" code, we can now create a flower garden with a variety of colors.

Source Code

The robot arm mentioned in hierarchies was also parameterized.

Source Code

Some other iterative examples: (courtesy of Beth Blostein and Terry Monnett)


Return to Schedule Information
mrl