title: What is redo in Prolog when you trace?
body: <p>I have this code(iterative deepening to find shortest path) :</p>
  
  <pre><code>arc(a, g).
  arc(a, b).
  arc(b, g).
  
  path(X, Z, Path) :-
      length(Path, _),
      path_r(X, Z, Path).
  
  path_r(Z, Z, []).
  path_r(X, Z, [X|Path]) :-
      arc(X, Y),
      path(Y, Z, Path).
  </code></pre>
  
  <p>And when I trace it, in one of the traces it gives me :</p>
  
  <pre><code>    2    2  Redo: length([],0) ? 
  </code></pre>
  
  <p>What's happening here?
  Also, what is 2 2 in the left of the line? </p>
  
  <p>The rest of the tracing:</p>
  
  <pre><code>  1    1  Call: path(a,g,_23) ? 
    2    2  Call: length(_23,_55) ? 
    2    2  Exit: length([],0) ? 
    3    2  Call: path_r(a,g,[]) ? 
    3    2  Fail: path_r(a,g,[]) ? 
    2    2  Redo: length([],0) ? 
    2    2  Exit: length([_80],1) ? 
    3    2  Call: path_r(a,g,[_80]) ? 
    4    3  Call: arc(a,_146) ? 
    4    3  Exit: arc(a,g) ? 
    5    3  Call: path(g,g,[]) ? 
    6    4  Call: length([],_158) ? 
    6    4  Exit: length([],0) ? 
    7    4  Call: path_r(g,g,[]) ? 
    7    4  Exit: path_r(g,g,[]) ? 
    5    3  Exit: path(g,g,[]) ? 
    3    2  Exit: path_r(a,g,[a]) ? 
    1    1  Exit: path(a,g,[a]) ? 
  </code></pre>