Oz and Mozart Users Mailing List

Re: "or" statement


From: Denys Duchier (Denys.Duchier@ps.uni-sb.de)
Date: Wed Sep 19 2001 - 14:40:47 CEST


Denys.Duchier@ps.uni-sb.de (Denys Duchier) writes:

> My point is that he really doesn't want `or', he wants `cond'.

On the other hand, if you want both a `cond'-like combinator and the
ability to enumerate the remaining alternatives if none becomes
entailed, then it is a bit harder. You cannot put a control variable
in any of the guards since it would prevent entailment even if it were
possible.

Instead, you need to design a new combinator. It's not too hard: most
of the code can be stolen from `cond' and `or'. See file
share/lib/cp/Combinator.oz in the source distribution.

Note however that this is a strange combinator with respect to search,
and may introduce incompleteness. if an alternative is entailed, then
that is the only one that will be explored even if other alternatives
are also entailed or merely satisfiable. But if no alternative is
entailed, then all those remaining will be explored.

My feeling is that such a combinator doesn't make much sense and that
it would be best if it turned out that you really just need `cond' or
just `or' :-)

Cheers,

PS: a difference between `or' and `cond' that just came back to me, is
that `or' will commit to the last remaining alternative, but `cond'
will not. Again, if you want this unit commit semantics, you need to
define a new combinator.

-- 
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.