Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Prolog PROG TECH. II Message-ID: <3647@goanna.cs.rmit.oz.au> Date: 31 Aug 90 02:50:12 GMT References: <3581@goanna.cs.rmit.oz.au> <126688@kean.ucs.mun.ca> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 41 In article <126688@kean.ucs.mun.ca>, jgarland@kean.ucs.mun.ca writes: > In article <3581@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au [I wrote] > > run(done) :- !. > > run(Event) :- /* Event ~= done */ > > exec_event(Event, NextEvent), > > run(NextEvent). > > > > If exec_event/2 is determinate, this is determinate. > > If exec_event/2 is not determinate, this is not determinate. > > > I say again, that I agree PDC (Turbo) Prolog cannot directly do some of the > interesting things other Prologs do. However, Tim's question revolved around > memory conservation, not metaprogramming. Yes, but _I_ wasn't talking about meta-programming _either_. I too was talking about memory management. I was saying that this two-clause approach is determiniate and tail recursive (provided only that exec_event/2 is determinate) so that >>>it runs in bounded stack<<<. > Nothing he has proposed in any of > his inquiries remotely requires that level of sophistication. What on earth is sophisticated about a two-clause tail-recursive loop? This is one of the cases where thinking in Pascal _does_ pay off; it is the direct transliteration of while Event <> done do Event := exec_event(Event); If this is sophisticated, then heaven help us all. > So, if the O'Keefe structure is of use to you, have no fear of using it. If > it isn't, remember that backtracking points are the thing to focus on...there > mustn't be any before the recursive call if you want to keep them from being > multiplied. */ But that is _precisely_ what the comment about wanting exec_event/2 to be determinate was _about_. -- You can lie with statistics ... but not to a statistician.