detour
¶(detour reorientation-traversal main-traversal)
Try executing a traversal by first reorienting yourself. If the main traversal fails, reorient yourself ("take a detour") and then try again. Keep repeating this until either the main traversal succeeds, or the reorientation fails. Both the main traversal as well as the reorientation can be any traversal.
Note that the reorientation is always executed prior to trying the main traversal, even the first time.
"Attempt to go forward by first going down, and keep going down to try again."
(symex-eval (symex-traversal (detour (move down) (move forward))))
"Attempt to go forward by first going down, and keep going down to try again as long as we don’t descend to the root of the tree."
(symex-eval (symex-traversal (detour (carefully (move down) (afterwards (not (at root)))) (move forward))))