Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!stretch.cs.mun.ca!leif!jgarland From: jgarland@kean.ucs.mun.ca Newsgroups: comp.lang.prolog Subject: Re: Prolog PROG TECH. II Message-ID: <130560@kean.ucs.mun.ca> Date: 31 Aug 90 12:19:49 GMT References: <3581@goanna.cs.rmit.oz.au> <126688@kean.ucs.mun.ca> <3647@goanna.cs.rmit.oz.au> Organization: Memorial University. St.John's Nfld, Canada Lines: 35 In article <3647@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: > 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. >> > > this two-clause > approach is determiniate and tail recursive (provided only that exec_event/2 > is determinate) so that >>>it runs in bounded stack<<<. > > [this] is _precisely_ what the comment about wanting exec_event/2 to be > determinate was _about_. I have no disagreement with this at all. My point is that if the exec_event/2 clauses are ordered such that the last clause, and only the last clause, contains the recursive call on all iterations but the last, *it does not matter* (to the PDC compiler anyway) that exec_event/2 is deterministic or nondeterministic. No additional stack space is consumed on each iteration, nor are any [additional] backtracking points generated. Question: Is this tantamount to saying exec_event/2 *is* deterministic for all practical purposes??? What am I missing? John Garland jgarland@mun Bitnet jgarland@kean.ucs.mun.ca Internet