🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #689

Re: Compilation of Disjuncts

#689
From: Richard A. O'Keefe
Date: Tue, 08 Sep 1992 04:20
35 lines
1388 bytes
In article <MATSC.92Sep2141625@vishnu.sics.se>, matsc@sics.se (Mats Carlsson) writes:
>    do you do anything special about this construct, or do you just
>    consider it as an ordinary predicate with a definition like:
>    P ;_Q :- P.
>    _P; Q :- Q.
> 
> SICStus Prolog does nothing special, and considers it as an ordinary
> predicate as you describe.

That cannot be so, because SICStus Prolog gets the right answer for this
program:

    p :- ( q(1), ! ; q(2) ).
    p :- q(3).

    q(X) :- write(X), nl.

    ?- p, fail.

The right answer is to write 1 and then fail.  If it were done this way:

    p :- 'OR'( (q(1),!), q(2) ).
    p :- q(3).

    'OR'(P, Q) :- call(P).
    'OR'(P, Q) :- call(Q).

    q(X) :- write(X), nl.

which _would_ treat ; as an ordinary predicate, then the output would
be 1 2 3.  SICStus Prolog gets this right, so there has to be _something_
special about disjunction.

-- 
You can lie with statistics ... but not to a statistician.
Technical Details
Message-ID: <14395@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
References: <1992Sep1.160505.6828@irisa.fr> <MATSC.92Sep2141625@vishnu.sics.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!goanna!ok
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: Compilation of Disjuncts
Message-ID: <14395@goanna.cs.rmit.oz.au>
Date: 8 Sep 92 04:20:34 GMT
References: <1992Sep1.160505.6828@irisa.fr> <MATSC.92Sep2141625@vishnu.sics.se>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 35