🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4239

Re: HELP!!! Please!

#4239
From: Jose Alberto Fernandez R
Date: Fri, 02 Mar 1990 00:04
48 lines
2194 bytes

>	process_entries:-
>		wait(X),
>		abolish(wait,1),
>		goal1(.....),
>		goal2(.....),
>		goal3(.....),
>		goal4(.....).
>	
>	The intention I had in writing this code was for backtracking to occur 
>	between goals 1 and 4.  Finally, goal1 will no longer be able to succeed.
>	When it fails, I want backtracking to go to wait(X); as long as there 
>	is at least one wait fact (wait is not a rule; just facts) in the database,
>	abolish them all, and begin with goal1 again; the existence of the wait
>	facts is what caused goal1 to fail in the first place.  In doing some
>	amount of tracing, I've discovered that goal1 is failing as expected,
>	the abolish is not backtracked to as expected, but that wait(X) is not
>	resucceeding; it fails immediately on backtracking EVEN THOUGH THERE
>	ARE SEVERAL wait(...) facts in the database!


You don't need the ABOLISH to do what you want. Without it, Prolog
will try each wait(X) clause only once, therefore you have what you
want.

If you want to delete these entries, so that no further execution will
used it, you can do that with:

process_entries:-
	wait(X),
	goal1(.....),
	goal2(.....),
	goal3(.....),
	goal4(.....).

process_entries:- 
	abolish(wait,1),
	fail.		/* This fail is for maintain the patterns in
			   the execution. */

	Jose Alberto.

--
:/       \ Jose Alberto Fernandez R | INTERNET: alberto@cs.umd.edu
:| o   o | Dept. of Computer Sc.    | BITNET: alberto@cs.umd.edu
:|   ^   | University of Maryland   | UUCP: {...}!mimsy!alberto
:\  \_/  / College Park, MD 20742   | 
Technical Details
Message-ID: <ALBERTO.90Mar1190445@konark.cs.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!elroy.jpl.nasa.gov!ames!dftsrv!mimsy!mimsy.umd.edu!alberto
References: <1990Mar1.210219.5687@Neon.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!elroy.jpl.nasa.gov!ames!dftsrv!mimsy!mimsy.umd.edu!alberto
From: alberto@konark.cs.umd.edu (Jose Alberto Fernandez R)
Newsgroups: comp.lang.prolog
Subject: Re: HELP!!! Please!
Message-ID: <ALBERTO.90Mar1190445@konark.cs.umd.edu>
Date: 2 Mar 90 00:04:45 GMT
References: <1990Mar1.210219.5687@Neon.Stanford.EDU>
Sender: news@mimsy.umd.edu
Organization: University of Maryland Computer Sc.
Lines: 48
In-reply-to: feldman@Neon.Stanford.EDU's message of 1 Mar 90 21:02:19 GMT