Reverse the order of keys in a tree
JavaScript function underlying the Tree.reverse builtin, with the same parameters and effects.
Tree.reverse