Unit 6 Teacher Guide

BJC Home
Unit 6 Student Pages
Introduction to Teacher Guide

Purpose

This unit extends the technique of recursion, introduced in Unit 5, to reporters, allowing us to write recursive functions.

In a sense, there is nothing new here: Students learned about reporters in Unit 1, and about recursion in Unit 5. But experience has shown that students have more trouble writing recursive functions than they do with recursive commands. The fact that the recursive calls come inside a combiner function, as explained in Lab 1, makes it even more important to develop the "leap of faith" understanding of recursion than in an imperative (command script) program.

After the brief introduction in Lab 1, we do something counterintuitive: We dive right into branched recursive functions, in which each call gives rise to two or more recursive calls. Linear-recursive functions (those with only one recursive call) are easier to write, but we avoid starting with them for two reasons:

Week by week stuff