Add visit-tree.

visit-tree calls a visit function for each leaf in the tree, passing the
path to the leaf and the leaf data. It returns a pair of trees, the
first containing all the successes, the second containing the failures.
Add skeleton handling for saving as well as restoring.