🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4257

Re: What does/should your Prolog make of this ?

#4257
From: Roland Karlsson
Date: Tue, 06 Mar 1990 13:29
28 lines
1725 bytes
> (1)   doo :- agenda(X), assertz(agenda(next)), write(X), fail.

> Now the problem with all of our Prolog interpreters (Prolog-2 from 
> Expert Systems International Ltd, Xprolog, SBprolog) is that they
> are so 'smart' as to see that with only ONE agenda() fact in the
> database, there is no need to keep a backtrack-point there, so that
> fact is interpreted as 

> agenda(start) :- !.

> And following assertz'ed agenda's are NOT found by backtracking, so
> the output is just 'start no', while what was intended is:
> 'startnextnextnextnextnextnext....' (database full) as a result.


In SICStus Prolog there is a sound implementation of assert after call.
In the example above above you will be able to backtrack to all
clauses (instances) of agenda/1 known at the time when calling agenda(X).
That is, no instances asserted after calling agenda(X) will be known.
It dosn't matter if there is 1 or more instances when first calling
agenda(X). The output will always be 'start - no' only.


--
Roland Karlsson
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN	Internet: roland@sics.se
Tel: +46 8 752 15 40	Ttx: 812 61 54 SICS S	Fax: +46 8 751 72 30
Technical Details
Message-ID: <1990Mar6.132958.6258@sics.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!sunic!sics.se!sics.se!roland
References: <1990Mar1.210219.5687@Neon.Stanford.EDU> <1557@maestro.htsa.aha.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!sunic!sics.se!sics.se!roland
From: roland@sics.se (Roland Karlsson)
Newsgroups: comp.lang.prolog
Subject: Re: What does/should your Prolog make of this ?
Message-ID: <1990Mar6.132958.6258@sics.se>
Date: 6 Mar 90 13:29:58 GMT
References: <1990Mar1.210219.5687@Neon.Stanford.EDU> <1557@maestro.htsa.aha.nl>
Sender: news@sics.se
Organization: Swedish Institute of Computer Science, Kista
Lines: 28
In-Reply-To: jand@maestro.htsa.aha.nl's message of 6 Mar 90 11:19:13 GMT