[mercury-users] determinism not satisfied

Peter Ross peter.ross at miscrit.be
Wed Jul 11 18:50:44 AEST 2001


Terence wrote:
> If anyone could help me get this simple program to work, I would
> appreciate it. Program and compilation error messages follow.
>
> % p.14 "Clause and Effect" by William Clocksin
>
> :- module border.
> :- interface.
> :- import_module io.
>
> :- pred main(io__state::di, io__state::uo) is det.
>
> :- implementation.
> :- import_module std_util.
>
> main -->
> { border("sussex",L) }, io__write_string(L).
>
> border("sussex","kent").
> border("sussex","surrey").
>
> adjacent(X,Y) :- border(X,Y).
> adjacent(X,Y) :- border(Y,X).
>
> affordable(X,Y) :- adjacent(X,Z), adjacent(Z,Y).
>
As the error message states the problem is due to determinism declaration
not being satisfied.
I would fist ask you to explicitly annotate each of the predicates with
their type/mode and determinism declarations.  I believe that first step is
necessary for understanding why this code doesn't work.  When you are happy
you understand why you have annoted border, adjacent and affordable with
their various determinisms, I will be happy to explain the error message.

Pete

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