[mercury-users] Translating from Prolog

David Overton dmo at cs.mu.OZ.AU
Tue Jun 8 01:53:20 AEST 2004


On Mon, Jun 07, 2004 at 04:51:02PM +0200, hanberg at ruc.dk wrote:
> I'm a Mercury newbie and would really like help to translate the following from
> Prolog to Mercury:
> 
> :- op( 500, xfy, &).
> :- op( 400, fy, ~).

Mercury does not allow you to change the precedence of operators.  Its
builtin definitions for & and ~ are

:- op( 1025, xfy, &).
:- op( 900, fy, ~).

so you are stuck with those.

> closes(~(X & Y)) :- closes(~X), closes(~Y).

You can use this clause as is.  You will need to define a type
containing your functions `~' and `&', and give type and mode
declarations for closes/1.


David
-- 
David Overton
WWW: http://www.overtons.id.au/
Mobile Phone (UK): +44 7799 344 322
--------------------------------------------------------------------------
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