Filip Konvička wrote:
The "choice" statement *does not* create a clone: clones are created
by the search engine only.
I know, I should have written "causes a space to be cloned".
That's not automatic. Search engines don't always make clones at each
level, in order to save memory. You can "recompute" a space from one of
its ancestors, provided you know the choices to take.
To support my claim, here is a search engine that never clones anything.
In the comments, the "history" of a given space is the sequence of
alternatives taken from the initial space (built from the script).
fun {SearchAll Script}
%% explore space S whose history is Is
fun {DFE S Is}
case {Space.ask S}
of failed then nil
[] succeeded then [{Space.merge S}]
[] alternatives(2) then
{Space.commit S 1}
{Append {DFE S {Append Is [1]}} {DFS {Append Is [2]}}}
end
end
%% build the space with history Is, and explore it
fun {DFS Is}
S={Space.new Script} in
for I in Is do {Space.commit S I} end
{DFE S Is}
end
in
{DFS nil}
end
The computation has been cloned exactly when the program was stuck at
the "choice" statement. At that point, the value of the cell was
false. So when the search engine backtracks, it restarts with a
computation where the cell has value false.
Which is exactly what I wrote, right?
Yes, I was just reformulating what you said in terms of spaces and cloning.
Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users