Article View: comp.lang.prolog
Article #341Re: logic programs -> procedural lang?
From: Richard O'Keefe
Date: Sat, 23 Sep 1989 05:10
Date: Sat, 23 Sep 1989 05:10
36 lines
1743 bytes
1743 bytes
In article <869@gamera.cs.utexas.edu>, bradley@cs.utexas.edu (Bradley L. Richards) writes: > As far as I'm aware, little work *has* been done in this area The first paper I saw on the subject was Chris Mellish's paper about the Prolog component of PopLog. I've seen several others since (alas, my library is in two other countries at the moment, so no reference) and they mostly follow his approach. Ignoring arguments, p :- built-in-test. p :- q. p :- r, s. is compiled as a function with a continuation argument: if it succeeds it calls its continuation; if it fails it returns. define p(Continuation); if built-in-test then call(Continuation); endif; q(Continuation); r(lambda (). s(Continuation endlambda); ;; fail by returning enddefine; The top-level predicate is called with a continuation which prints the variable bindings and then either returns (if the user types ";") or longjumps all the way out (if the user types <CR>). I don't remember how cuts are handled. In a language like C which doesn't let you construct closures (lambda ... endlambda) you can get the same effect by pushing information on a "continuation stack". There are actually some similarities between this method and David Warren's "total non-structure-sharing".
Technical Details
Message-ID:
<2169@munnari.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ames!uhccux!munnari.oz.au!cs.mu.oz.au!okReferences:
<27335@shemp.CS.UCLA.EDU> <869@gamera.cs.utexas.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ames!uhccux!munnari.oz.au!cs.mu.oz.au!ok From: ok@cs.mu.oz.au (Richard O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: logic programs -> procedural lang? Summary: done several times Message-ID: <2169@munnari.oz.au> Date: 23 Sep 89 05:10:51 GMT References: <27335@shemp.CS.UCLA.EDU> <869@gamera.cs.utexas.edu> Sender: news@cs.mu.oz.au Lines: 36