[mercury-users] Prolog
Ralph Becket
rafe at cs.mu.OZ.AU
Thu Mar 13 10:28:21 AEDT 2003
Fergus Henderson, Thursday, 13 March 2003:
> On 11-Mar-2003, suja c <suja_cin at yahoo.com> wrote:
>
> > 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".
The following is also an (unfortunately) common Prolog idiom
(
generate(...), % nondet
test(...), % semidet
do_some_io(...), % det
fail
;
true
)
You can do this sort of thing purely declaratively using
unsorted_aggregate or do_while from the std_util Mercury standard
library module.
Ralph
--------------------------------------------------------------------------
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