[mercury-users] Translating from Prolog

hanberg at ruc.dk hanberg at ruc.dk
Tue Jun 8 05:19:21 AEST 2004


Quoting David Overton <dmo at cs.mu.OZ.AU>:

> 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, ~).

Ok, I didn't know that they already were defined, since I tried using them and
couldn't make it work.

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

I tried looking in the tutorial and on the Internet, but I can't really make
that work. What would you write in a case like this?

> 
> 
> 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
> --------------------------------------------------------------------------
> 
Thank you for your help!

Tony

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