Guided Practice 6.7: Fancier Tree Fold

Recall the data type from Guided Practice 5.1, consisting of trees with numbers in the leaves and with two kinds of interior nodes: one kind with two sons and one kind with three sons.

  1. Write a fold function for these trees.
  2. Using your fold function, write leaf-max for these trees.
  3. Using your fold function, write a function double-all that takes one of these trees and returns a tree of the same shape in which all the leaves are doubled. (This is the same as in Guided Practice 5.1).

[ANSWER]

(Remember, you won't get anything about of this exercise unless you actually write the code and test it.)

Last modified: Mon Sep 18 16:48:29 Eastern Daylight Time 2017