home *** CD-ROM | disk | FTP | other *** search
- Path: 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: <14393@goanna.cs.rmit.oz.au>
- Date: 8 Sep 92 04:15:13 GMT
- References: <1992Sep1.160505.6828@irisa.fr>
- Organization: Comp Sci, RMIT, Melbourne, Australia
- Lines: 23
-
- In article <1992Sep1.160505.6828@irisa.fr>, serge@irisa.fr (Serge Lehuitouze) writes:
- > You, WAM gurus, 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.
-
- There is a third possibility: when a clause contains a goal of the form
- (P ; Q), e.g. H :- A, (P ; Q), B
- split that goal out as a separate predicate:
- T(Xs) :- P.
- T(Xs) :- Q.
- H :- A, T(Xs), B.
- where Xs is vars([P,Q]) intersect vars([H,A,B]).
-
- But yes, disjunction is usually compiled specially, for two important
- reasons:
- 1. It would be unreasonably slow and inefficient to do otherwise.
- 2. Disjunction and if->then;else are transparent to cuts, that is,
- a cut inside one of them has effect on the whole predicate,
- not just the disjunction or if->then;else.
-
- --
- You can lie with statistics ... but not to a statistician.
-