The alternative is to have the accumulator stand for the lost items in the tree. Let's explore both possibilities, starting with the first. Initially, all-a has not seen any of the nodes in the family tree, so accumulator is empty . This leaves us with the answer in the first cond -clause. Since accumulator represents all blue-eyed ancestors encountered so far, it is the result.
Figure contains the complete definition.
For the second version, we want the accumulator to represent a list of all of the family trees that haven't been processed yet. To visit all those family trees, all-a must be applied to them, one at a time. The rest of the list is what is now left to do. The auxiliary definition is the most unusual recursive function definition we have seen. That is, the function definition does not match the data definition for family trees, the primary inputs.