🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #966

Re: Prolog's pitfalls

#966
From: David Bowen
Date: Thu, 12 Jul 1990 02:19
18 lines
1512 bytes
>About cuts and assert, I will only say that competent Prolog programmers
>know that the fewer of them they use, the faster their programs are likely
>to be.

I agree with this statement but think it is dangerously misleading with respect
to the use of cut.  The most serious efficiency problem that people have with
Prolog is that they fail to make logically determinate predicates actually
determinate.  If the Prolog implementation isn't able to spot the determinacy
it has to keep backtracking information around indefinitely, which can waste
arbitrary amounts of space.  The simplest way to correct this is to add cuts at
all appropriate places.  Richard's point is that by careful design of your data
structures and your program you can very often get all or most of your
determinacy by exploiting first-argument-indexing, avoiding the need for cuts
and ending up with a more efficient and more understandable program.  He does
not mean that you should simply leave out cuts to get speed.

The text books that I have looked at do not explain this at all well.
Technical Details
Message-ID: <1396@quintus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!sun-barr!newstop!sun!quintus!dave

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!sun-barr!newstop!sun!quintus!dave
From: dave@quintus.UUCP (David Bowen)
Newsgroups: comp.lang.prolog
Subject: Re: Prolog's pitfalls
Keywords: cut, Prolog efficiency
Message-ID: <1396@quintus.UUCP>
Date: 12 Jul 90 02:19:12 GMT
Organization: Quintus Computer Systems, Mountain View, CA
Lines: 18