My solution to Chris Okasaki's functional pearl: given a tree, reproduce a tree with the same structure with nodes numbered in breadth-first order (using only immutable data structures, of course).
For more on streams and lazy lists, check out chapter 3 of SICP. For more on pure functional queues, see this other paper by Chris Okasaki.
I'm not completely happy with my solution. On the plus side, it generalizes to non-binary trees. But performing a breadth-first search to calculate node numbers and a depth-first map to apply them is inefficient. I tried to construct my solution from the