🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3378

Re: Clause fusion

#3378
From: Saumya Debray
Date: Tue, 17 May 1988 00:58
45 lines
1546 bytes
In article <5502@megaron.arizona.edu>, I wrote:

>     E.g., suppose p/1 is a deterministic predicate, then
>     
>     	   Lits1, p(Arg), !, Lits2
> 
>     is equivalent to
> 
>     	   Lits1, !, p(Arg), Lits2.

This statement, made in a moment of optimism, is of course false.  There
are at least two reasons for this:

(i) suppose p/1 is defined as
	   
	   p(a).
	   p(X) :- p(f(X)).

    Then p/1 generates at most one solution to any query, and hence is
    deterministic.  The goal
    
    	   ?- p(X), !, fail.

    clearly doesn't behave the same way as
   
   	   ?- !, p(X), fail.

(ii) In

 	   Lits1, p(X), !, Lits2
	   
	choice points for  Lits1  are discarded only _after_ p/1 succeeds; in
	
	   Lits1, !, p(X), Lits2

    choice points for Lits2 are discarded _before_ p/1 is executed.  This
    can cause a difference in behavior if Lits1 generates more than one
    solution, and p/1 fails the first time through.

Sorry about that.
-- 
Saumya Debray		CS Department, University of Arizona, Tucson

     internet:   debray@arizona.edu
     uucp:       {allegra, cmcl2, ihnp4} !arizona!debray
Technical Details
Message-ID: <5506@megaron.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!ames!ncar!noao!arizona!debray
References: <983@cresswell.quintus.UUCP> <5502@megaron.arizona.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!ames!ncar!noao!arizona!debray
From: debray@arizona.edu (Saumya Debray)
Newsgroups: comp.lang.prolog
Subject: Re: Clause fusion
Summary: goofed, sorry
Message-ID: <5506@megaron.arizona.edu>
Date: 17 May 88 00:58:42 GMT
References: <983@cresswell.quintus.UUCP> <5502@megaron.arizona.edu>
Organization: U of Arizona CS Dept, Tucson
Lines: 45