home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / prolog / 1673 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.2 KB

  1. Path: sparky!uunet!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!sics.se!roland
  2. From: roland@sics.se (Roland Karlsson)
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: Compilation of Disjuncts
  5. Message-ID: <ROLAND.92Sep8085939@helicon.sics.se>
  6. Date: 8 Sep 92 07:59:39 GMT
  7. References: <1992Sep1.160505.6828@irisa.fr> <MATSC.92Sep2141625@vishnu.sics.se>
  8.     <14395@goanna.cs.rmit.oz.au>
  9. Sender: news@sics.se
  10. Organization: Swedish Institute of Computer Science, Kista
  11. Lines: 24
  12. In-Reply-To: ok@goanna.cs.rmit.oz.au's message of 8 Sep 92 04:20:34 GMT
  13.  
  14.  
  15. SICStus Prolog do it this way:
  16.  
  17. p :- (x,! ; y).                 q :- a, (b,! ; c).
  18. p :- z.                         q :- d.
  19.  
  20.                   is converted to
  21.  
  22. p :- choice(C), x, cut(C).      q :- choice(C), a, q'(C).
  23. p :- y.                         q :- d.
  24. p :- z.
  25.                                 q'(C) :- b, cut(C).
  26.                                 q'(_) :- c.
  27.  
  28. Where choice(C) binds C to a reference to the youngest choicepoint alive
  29. when calling q/0 or p/0, and cut(C) clears all choicepoints younger than C.
  30.  
  31.  
  32.  o
  33. Ralle
  34. --
  35. Roland Karlsson             SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
  36. Internet: roland@sics.se    Tel: +46 8 752 15 40          Fax: +46 8 751 72 30
  37. Telex: 812 6154 7011 SICS   Ttx: 2401-812 6154 7011=SICS
  38.