I'm confused. My message wasn't talking about backtracking. It only suggested that it would be useful to define a =/3, which returned true or false as a value depending on whether its first two argument could be unified. As a side effect, it would unify those first two arguments if possible.   Since =/2 is defined as part of the base language, this would not require anything new. It could be defined easily as in my example.
 
-- Russ

 
On 10/5/05, Raphael Collet <[EMAIL PROTECTED]> wrote:
Russ Abbott wrote:
> Define a proc Unify/3 that attempts to unify its first two arguments and
> sets its third argument to true/false depending on whether not it succeeds.
>
>     local
>        proc {Unify X Y Z}
>           try X = Y Z = true
>           catch _ then Z = false
>           end
>        end
>        A B
>     in
>        if {Unify [A b a] [a B B]} then {Browse 1#A#B}
>        elseif {Unify [A b] [a B]} then {Browse 2#A#B}
>        end
>     end
>
> It would be even nicer if value.'=' were defined as both =/2 and =/3,
> with the latter being defined as above.

Sorry, the logic part of Oz is not an inclusion of Prolog.  Unification
and testing for equality are distinct in Oz.  The base model of Oz
(concurrent constraints) requires to distinguish between both.

The statement X=Y tells the constraint X=Y to the store, while X==Y asks
whether the store entails X=Y.  The latter blocks if the constraint
store does not contain enough information.

This behavior combines very naturally with concurrency.  Testing
equality cannot tell extra constraints to the store (like Prolog would).
  A "speculative" unification is problematic, because backtracking one
thread would require to backtrack all threads in the system.  That is
unreasonable to implement.

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               [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

Reply via email to