Oz and Mozart Users Mailing List

Re: "or" statement


From: Luis Quesada (luque@info.ucl.ac.be)
Date: Wed Sep 19 2001 - 13:37:04 CEST


Denys Duchier wrote:

> luque@info.ucl.ac.be (Luis Quesada) writes:
>
> > I think you can get this effect with conditionals + a control
> > variable if your clauses are pairwise excluding.
> >
> > cond Constraint_0 then C=0 end
> > cond Constraint_1 then C=1 end
> > [...]
>
> Actually, what Jorge wants is precisely the semantics offered
> _directly_ by cond. cond concurrently evaluates its guards, each one
> in its own space, and commits to the first one that is entailed,
> killing the others.
>

Indeed?

>
> For example, the following is one possible way to wait for the first
> variable of X, Y and Z to become determined (though using WaitOr would
> be more efficient):
>
> declare X Y Z
> cond {Wait X} then {Show x}
> [] {Wait Y} then {Show y}
> [] {Wait Z} then {Show z} end
>
> Now, determine Y=foo and watch it print out y. The clauses for X and
> Z are silently destroyed.
>
>

I thought he needed that the or disappears as soon as it is known that a
clause is entailed. In the following example X never gets determinate if
the or is not used.

declare X
thread
   cond
      fail then {Browse 1}
   []
      X=1 then {Browse 2}
   []
      fail then {Browse 3}
   end
end
thread
   or
      fail
   []
      X=1
   []
      fail
   end
end

Luis

--
Catholic University of Louvain
Department of Computing Science and Engineering
Place Sainte Barbe, 2
B-1348 Louvain-la-Neuve, Belgium
Phone: (++32) (10) 47 90 13
Fax: (++32) (10) 45 03 45
E-mail: luque@info.ucl.ac.be

- Please send submissions to users@mozart-oz.org and administriva mail to users-request@mozart-oz.org. The Mozart Oz web site is at http://www.mozart-oz.org/.



This archive was generated by hypermail 2b29.