[mercury-users] Determinism of try/2

Mark Brown mark at cs.mu.OZ.AU
Wed Jan 25 10:49:52 AEDT 2006


Hi Peter,

On 24-Jan-2006, Peter Hawkins <hawkinsp at cs.stanford.edu> wrote:
> Hi...
> 
> Why does exception.try/2 have determinism cc_multi when called on a det 
> predicate? It doesn't look like a committed choice operation to me...

The solutions for such a call are succeeded(R) where R is the result
according to the declarative semantics of the det predicate, and
exception(E) where E is any value (with type univ).  Only one of these
solutions is chosen at run time; you can't get the other ones on
backtracking.

The det predicate itself is still det, even though its behaviour also
covers these possibilities.  The reason is that an exceptional result is
not considered to be a solution.  Rather, it is a form of non-termination;
as such, it is not modelled by the declarative semantics (indeed, it is
an "exception" to the declarative semantics).

> 
> (Incidentally the standard library probably needs a version of try/2 for 
> functions as well)

I agree.  Feel free to submit a patch.  ;-)

Cheers,
Mark.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list