Path: utzoo!attcan!uunet!husc6!mailrus!ames!sri-spam!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: determinism, once etc, Trilogy Message-ID: <982@cresswell.quintus.UUCP> Date: 16 May 88 04:24:28 GMT References: <2316@ubc-cs.UUCP> <6960007@hpfclp.SDE.HP.COM> Organization: Quintus Computer Systems, Mountain View, CA Lines: 19 In article <6960007@hpfclp.SDE.HP.COM>, fritz@hpfclp.SDE.HP.COM (Gary Fritz) writes: > Obviously, if you know early in a predicate that a cut will be required, > THAT is the place to insert the cut. Such a predicate is not necessarily > a good candidate for a deterministic declaration, if you use that as a > substitute for the earlier cut. If, however, you know that the predicate > can only generate one solution, it may make sense to declare it deterministic > _in addition to_ the earlier cut, so that OTHER predicates may call it > more efficiently. > > Gary Agreed, it _may_ make sense. It's highly implementation dependent. On a WAM-based system like Quintus Prolog, SICStus Prolog, or SB-Prolog, it would not be a good idea. If the compiler were smart enough to figure out that the additional cuts weren't necessary, then it would be a good idea, but then you wouldn't _need_ the :- deterministic declaration (though it would remain as a valuable declaration of intent). (Functional dependencies such as Kamran Parsaye suggested years ago would be even better.)