Figure 6 shows the use of a built-in iteration machine, the Repeat machine. Figure 6 Using iteration with the Repeat machine to generate a closed spiral. Nested iterative operations are a great deal easier to follow in this iconic visual form than in the usual one-dimensional textual representation. Even more striking in its clarity is the. Function Machines representation of recursion.
Recursion is a great deal more confusing than iteration to beginning students.
The idea of a procedure being defined in terms of itself seems cryptic, circular, even nonsensical. The sense and operation of recursion becomes marvelously clear in Function Machines, opening the way for students to experience and explore the extraordinary mathematical power of recursive processes. Figure 7 shows the use of recursion in a Function Machines program, the polyspi machine. Figure 7 Recursive computation of a polygonal spiral. The inner body of polyspi is shown on the right.