[Oz] equality of unbound variables
Denys Duchier
Denys.Duchier at ps.uni-sb.de
Tue Dec 21 11:44:01 CET 1999
tinelli at cs.uiowa.edu (Cesare Tinelli) writes:
> > What you want to do sounds very much like a Prolog trick.
>
> Well, what you suggest below looks a lot like an Oz trick instead :)
It may look that way, but it has the advantage of being on secure
semantic ground.
The usual way to do in Oz what I think you want to do is by a
combination of what Christian and I described: I'll call this an
"encapsulated term". An "encapsulated term" is represented by a
function. Invoking the function creates a new "clone" of said term.
All operations on encapsulated terms are effected in new computational
spaces and return new encapsulated terms. Here is an example:
Let's say F1 and F2 are two encapsulated terms and R is a function
that takes two terms and returns a new one (this might be an
inference). Here is how to obtain the new encapsulated conclusions
that follow from F1 and F2 by R:
declare L = {Search.allP proc {$ T3} {R {F1} {F2} T3} end 1 _}
L is now a list of encapsulated terms. This is the technique that we
used to implement e.g. a number of natural language parsers (in
particular chart parsers).
The constraint programming / search aspect of Oz were designed around
the notion of encapsulation. The implementation supports this _very_
efficiently; more efficiently (and correctly) than what you are likely
to achieve by programming it yourself :-)
To really use Oz effectively, it is best to buy into its paradigm.
That's why I would like to encourage you to consider using
"encapsulated terms" if at all appropriate for your application. You
will find they make your life a lot easier :-)
Cheers,
--
Dr. Denys Duchier Denys.Duchier at 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 at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
More information about the mozart-users
mailing list