Oz and Mozart Users Mailing List

Re: "or" statement


From: Denys Duchier (Denys.Duchier@ps.uni-sb.de)
Date: Wed Sep 19 2001 - 12:29:22 CEST


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.

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.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615
-
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.