Chris Rathman wrote:
It's a solution to my immediate problem, but I'm still at a loss as to why my original attempt enters into a wait. In combining some ideas that you gave me, with my original attempts, I think I see where I've been going astray. It would appear that binding a top level variable within a choice statement causes my grief. In piecing together the behavior, I wrote 3 versions of the list generator. The first (ListA) generates the infinite choices similar to your solution with no binding involved. The second (ListB) tries to bind the variable that is sent to the function. The third (ListC) is what I originally started with - it has the same problem as ListB.

So, I guess my question is: Is it not possible to bind a top level variable within Choice? I'm speculating that the choice doesn't allow a bind, but rather goes into a wait until such time as the top level space gets bound. But since the top level is waiting on the choice to succeed, you go into a wait state.

The problem is not binding the global variable. The problem is deciding whether the local computation space has failed.

  local X in
     {Browse c2#{SolveN 1 fun {$} {ListC 1|2|3|X} end}}
  end

Notice that in this case you will get different answers depending on the value to which X is bound outside. So, Space.ask (which in used in Solve (http://www2.info.ucl.ac.be/people/PVR/ds/booksuppl.oz)) does need to wait in order to decide whether the space at hand has failed or not.

Condiser, this case:

declare X={FD.int 1#3}
proc {Script _}
   choice X=0 [] X=4 end
end
{Browse {SearchAll Script}}

In this particular case, you don't need to wait for the total determination of X since in each case Space.ask will find that the space has failed. We can say that the set of solutions does not depend on the value to which X is bound outside because there is no solution (given the partial determination of X and the values to which X is bound in the local computation spaces).

Luis

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to