home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!sh.wide!hitwide!hinocgw!hcrlgw92!hitgw!icot32!ss151.icot.or.jp!ss151!chik
- From: chik@icot.or.jp (Takashi Chikayama)
- Newsgroups: comp.lang.prolog
- Subject: Re: Compilation of Disjuncts
- Message-ID: <CHIK.92Sep3111051@ss38.icot.or.jp>
- Date: 3 Sep 92 02:10:51 GMT
- References: <1992Sep1.160505.6828@irisa.fr> <MATSC.92Sep2141625@vishnu.sics.se>
- Sender: news@ss151.icot.or.jp
- Reply-To: chikayama@icot.or.jp
- Organization: Institute for New Generation Computer Technology, Tokyo, Japan.
- Lines: 32
- In-Reply-To: matsc@sics.se's message of 2 Sep 92 13: 16:25 GMT
-
- 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.
-
- Don't you have to do something special to extend the scope of cut
- operators? As I understand it, the program A below has only one
- solution of X=1, while the program B should have both X=1 and X=2.
-
- program A:
- p(X) :- q(X), (true, !; fail).
- q(1). q(2).
- ?- p.
- program B:
- p(X) :- q(X), or((true, !), fail).
- q(1). q(2).
- or(T, _F) :- T.
- or(_T, F) :- F.
- ?- p.
-
- In case of SICStus, this "something special" might have been small.
- More complicated mechanisms might be needed in an implementation
- without a separate choice point stack.
-
- Takashi Chikayama
- ICOT
-