Contents   
Page-10   
Prev   
Next   
Page+10   
Index   
  Tail-Recursive Search 
The search algorithm can also be written in a tail-recursive style.
-  The path (sequence of operators) to the goal is passed down
as a variable, initially  '().
 
-  Each time an operator  op is applied to create a new state,
 op is  consed onto the path for the recursive call.
Since  cons acts as a stack and makes a list in backwards order,
the path is a backwards list of operators taken from the start.
 
-  When the goal is found, a  reverse of the path gives a
solution (sequence of operators to get from the start to the goal).