7.2.7 circuit

Syntax

(circuit traversal [times])

or

(repeat traversal [times])

Description

Repeat a traversal a given number of times or as long as it succeeds. When it fails, stop.

Examples

"Move forward three times."

(symex-eval
  (symex-traversal
    (repeat (move forward) 3)))

"Keep moving forward."

(symex-eval
  (symex-traversal
    (repeat (move forward))))

"Keep moving down and forward, as long as we don’t descend to the root node."

(symex-eval
  (symex-traversal
    (repeat
      (carefully
        (try (move down)
             (move forward))
        (afterwards (not (at root)))))))