home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / prolog / 1640 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.5 KB

  1. Path: sparky!uunet!sun-barr!sh.wide!hitwide!hinocgw!hcrlgw92!hitgw!icot32!ss151.icot.or.jp!ss151!chik
  2. From: chik@icot.or.jp (Takashi Chikayama)
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: Compilation of Disjuncts
  5. Message-ID: <CHIK.92Sep3111051@ss38.icot.or.jp>
  6. Date: 3 Sep 92 02:10:51 GMT
  7. References: <1992Sep1.160505.6828@irisa.fr> <MATSC.92Sep2141625@vishnu.sics.se>
  8. Sender: news@ss151.icot.or.jp
  9. Reply-To: chikayama@icot.or.jp
  10. Organization: Institute for New Generation Computer Technology, Tokyo, Japan.
  11. Lines: 32
  12. In-Reply-To: matsc@sics.se's message of 2 Sep 92 13: 16:25 GMT
  13.  
  14. In article <MATSC.92Sep2141625@vishnu.sics.se>
  15.     matsc@sics.se (Mats Carlsson) writes:
  16.  
  17.  |   do you do anything special about this construct, or do you just
  18.  |   consider it as an ordinary predicate with a definition like:
  19.  |   P ;_Q :- P.
  20.  |   _P; Q :- Q.
  21.  |
  22.  |SICStus Prolog does nothing special, and considers it as an ordinary
  23.  |predicate as you describe.
  24.  
  25. Don't you have to do something special to extend the scope of cut
  26. operators?  As I understand it, the program A below has only one
  27. solution of X=1, while the program B should have both X=1 and X=2.
  28.  
  29.    program A:
  30.     p(X) :- q(X), (true, !; fail).
  31.     q(1). q(2).
  32.     ?- p.
  33.    program B:
  34.     p(X) :- q(X), or((true, !), fail).
  35.     q(1). q(2).
  36.     or(T, _F) :- T.
  37.     or(_T, F) :- F.
  38.     ?- p.
  39.  
  40. In case of SICStus, this "something special" might have been small.
  41. More complicated mechanisms might be needed in an implementation
  42. without a separate choice point stack.
  43.  
  44. Takashi Chikayama
  45. ICOT
  46.