Article View: comp.lang.prolog
Article #969Re: Prolog's pitfalls
From: Jamie Andrews
Date: Thu, 12 Jul 1990 11:39
Date: Thu, 12 Jul 1990 11:39
23 lines
1709 bytes
1709 bytes
In article <1396@quintus.UUCP> dave@quintus.UUCP (David Bowen) writes:
>... 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....
This reminds me of something I've been wondering about for
a while. Built-in "if-then-else" and "case" constructs are
often touted as a way of getting around using cuts. What is the
current wisdom about this? I know that not all uses of cut can
be replaced by if-then-else, but what proportion of them can?
(I seem to remember hearing some figure like 70% at one point --
don't know how this was measured, though.)
On a related point, what proportion of instances of
negation can be eliminated by using if-then-elses? (The
problems of negation wouldn't be eliminated, of course, but if
we could replace negation by if-then-else there would be more
uniformity with other programming languages.)
--Jamie. Original material copyright (c) 1990 by Jamie Andrews;
jha@lfcs.ed.ac.uk for distribution only on unmoderated USENET newsgroups.
"If you try to leave this room, I'll tackle you." -- Don Getty to Clyde Wells
Technical Details
Message-ID:
<5135@castle.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!edcastle!lfcs!jhaReferences:
<1396@quintus.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!edcastle!lfcs!jha From: jha@lfcs.ed.ac.uk (Jamie Andrews) Newsgroups: comp.lang.prolog Subject: Re: Prolog's pitfalls Keywords: cut, Prolog efficiency Message-ID: <5135@castle.ed.ac.uk> Date: 12 Jul 90 11:39:15 GMT References: <1396@quintus.UUCP> Reply-To: jha@lfcs.ed.ac.uk (Jamie Andrews) Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 23