Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!inesc!unl!om!px From: px@unl.fctunl.rccn.pt (Joaquim Baptista (pxQuim)) Newsgroups: comp.lang.prolog Subject: Re: retractall and backtracking Message-ID: Date: 13 Jun 89 02:50:34 GMT References: <575@hfserver.hfnet.bt.co.uk> <10539@burdvax.PRC.Unisys.COM> Sender: px@unl.fctunl.rccn.pt Organization: Universidade Nova de Lisboa, Portugal Lines: 39 In-reply-to: armagan@PRC.Unisys.COM's message of 12 Jun 89 14:09:24 GMT Posting-Front-End: GNU Emacs 18.44.13 of Wed Jun 24 1987 on om (berkeley-unix) In article <10539@burdvax.PRC.Unisys.COM> armagan@PRC.Unisys.COM (Armagan Ozdinc) writes: In article , Joaquim Baptista writes: > > Variations on this problem also arise with asserta and assertz, as in: > > /* this will loop forever, exhausting your heap space, > writing 1211111111... */ > b(1). b(2). > exec2:- b(X), write(X), assertz(b(X)), fail. > In Quintus Prolog 2.4, exec2 doesn't behave as you describe above. It prints 12 and fails. Armagan Ozdinc Unisys Corporation Paoli Research Center One of the postings on this subject mentioned that Quintos Prolog has the nice property of 'freezing' the definition of a predicate when you call it, which seems nice to me. This is a solution to the assert/retract semantics that I had never heard of. However, Prolog-2 for IBM PC and C-Prolog will behave as I said. I believe Arity/Prolog will do that as well, but I'me not completely sure. -- -------- Joaquim Manuel Soares Baptista | BITNET/Internet: px@fctunl.rccn.pt Centro de Inteligencia Artificial | UUCP: px@unl.uucp Uninova | ARPA: px%fctunl.rccn.pt@mitvma.mit.edu Fac. de Ciencias e Tecnologia/UNL | PSI/VMS: PSI%(+2680)005010310::PX 2825 Monte de Caparica | Fax: (+351) (1) 295 4461 PORTUGAL | Sound: (+351) (1) 295 4464 ext. 1360