🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4227

Re: loops in prolog

#4227
From: #Stefan Bachert
Date: Tue, 27 Feb 1990 14:01
22 lines
670 bytes
Hello,

Try

loop:-
	repeat,
	action_1,
	(not condition_1;action_2,fail),
	action_3.


You must take care of backtracking. Use a predicate
like 
	once_true(X):-call(X),!.
	once_true(_).

for calling action_? . 

I hope this will help you


Stefan Bachert
Technical Details
Message-ID: <470002@hpbbi4.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucsd!nosc!helios.ee.lbl.gov!pasteur!ucbvax!hplabs!hp-ses!hpbbn!hpbbi4!stefan
References: <1032@fs1.ee.ubc.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucsd!nosc!helios.ee.lbl.gov!pasteur!ucbvax!hplabs!hp-ses!hpbbn!hpbbi4!stefan
From: stefan@hpbbi4.HP.COM (#Stefan Bachert)
Newsgroups: comp.lang.prolog
Subject: Re: loops in prolog
Message-ID: <470002@hpbbi4.HP.COM>
Date: 27 Feb 90 14:01:40 GMT
References: <1032@fs1.ee.ubc.ca>
Organization: Hewlett-Packard GmbH
Lines: 22