map_tree/4¶
map_tree(+ Pred, + OldTree, - NewTree)*
Holds when OldTree and NewTree are binary trees of the same shape and Pred(Old,New)
is true for corresponding elements of the two trees.
is true when OldTree and NewTree are binary trees of the same shape and Pred(Old,New) is true for corresponding elements of the two trees. In fact this routine is perfectly happy constructing either tree given the other, I have given it the mode I have for that bogus reason "efficiency" and because it is normally used this way round. This is really meant more as an illustration of how to map over trees than as a tool for everyday use.