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