Dear Rusreg (sorry, that is the only name you provided),
Unification in Oz is actually like unification in Prolog, with one
important difference -- unification and search are independent in Oz.
That way, you can use unification in deterministic programs where it
will only add as much information to the store as can be added
without search. For example, if you do
X = [hi _ _]
Y = [_ there _]
X = Y
then X and Y are unified to [hi there _], and the last variable is
left undetermined.
If you combined unification and search, then you have the programming
model of Prolog, as detailed in chapter 9 of CTM.
Best
Torsten
On Jul 10, 2009, at 10:21 PM, Rusreg wrote:
Peter wrote:
Another point about nondeterministic functions: the use of 'dis' is
deprecated in Mozart. You should use 'choice' instead. The
reason has
to do with Prolog-style versus constraint-style programming. Prolog
programs basically do generate and test (enumerate and then prune).
Constraint programs do pruning before enumeration (using
propagators),
which is more efficient. 'Dis' is a kind of poor man's way for
Prolog
programs to do a little bit of pruning, but it is a dead end
since it is
still in the Prolog style. If you really need nondeterminism
(search)
in a strong way, you should use the constraint style and not the
Prolog
style. If you need just a little bit of nondeterminism or if you
are
just exploring solutions in a simple way, you can use Prolog
style. But
Prolog style does not scale up to real problems.
Thank you very much for this explanation. I am very happy to know
that the solving of constraints differs from prolog enumeration
(becouse this enumeration is very painful fact and uneffective).
But I have the one question about constraints. Is there some
difference between
using constraints (and 'choise') in Mozart/Oz and Alice languages?
I decided to use Oz because Alice lack of unification that Oz have.
Is it this unification boils down to Prolog-style programming (with
dis) or there are other mechanism of unification?
______________________________________________________________________
___________
mozart-users mailing list mozart-
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users