You need to walk a data structure, and the nodes you visit determine what to do. A simple example is to search a rose-tree for a given value. A more complex example is accumulate a set of bindings based on the nodes you encounter.
Use continuations! Pass in two stub procedures (succ, fail) that know what to do in the base case, and extend those procedures at each successive stage. Then, tail-call those procedures when needed -- ie. call success with the accumulator, or fail with nothing.
I learned this technique from Gregor Kiczales, but it is described in various places, including SICP2, EOPL2, and Friedman's papers. The earlier I've traced it is to deBruijn 1989.