[mercury-users] Prolog

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 13 01:23:10 AEDT 2003

On 11-Mar-2003, suja c <suja_cin at yahoo.com> wrote:
> Can you please provide any other material regarding
> mercury andprolog comparison other than the transition
> guide.

Well, there's also some benchmark results on our site:

> Does mercury support the repeat predicate of
> prolog? What is the equivalent for that in Mercury.

In Prolog, "repeat" is used for failure-driven loops.  As it says in
the transition guide, "failure-driven loops in Prolog programs should
be transformed into ordinary tail recursion in Mercury".

For example, the Prolog code

	loop(...) :-
		dosomething(...),	% det
		test(...),		% semidet
		... bind output arguments ...

can be better written in Mercury (or Prolog) as

	loop(...) :-
		( test(...) ->
			... bind output arguments ...

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
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