guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delimeted continuations for gule-log guile-prolog and kanren


From: Stefan Israelsson Tampe
Subject: Re: Delimeted continuations for gule-log guile-prolog and kanren
Date: Sun, 6 Oct 2013 23:33:40 +0200

To note is that I published the documentation for guile-log at,

   http://c-lambda.se/guile-log

I added the documentation for the new prompt ideom as well as a section for how one can do
parsing in guile-log. Previously there is a short description of postpone a guile-log version of prologs dynamic variables as well as the interfaces kanren and guile-log.

Have fun!!


On Sat, Oct 5, 2013 at 8:24 PM, Stefan Israelsson Tampe <address@hidden> wrote:
Hi all,

Delimited continuations are a really nice feature in guile. I have now implemented that
for guile-log and hence also for kanren and prolog. With it we can now do
------------------------
(use-modules (logic guile-log))
(use-modules (logic guile-log umatch))

(<define> (f)
  (<values> (i x) (<abort> 'tag (<lambda> (i x) (<cc> i x))))  
  (<or-i>
   (<or> (<=> x i)      (<=> x ,(+ i i)))
   (<or> (<=> x ,(- i)) (<=> x ,(- (+ i i))))))


(<define> (test x y)
  (<prompt> 'tag #f f
    (<lambda> (tag next kk)
        (<let> ((k (kk)))
  (<zip> (x (k 1  x))
 (y (k 10 y)))))))

(<run> 10 (x y) (test x y))

--> $1 = ((1 10) (-1 -10) (2 20) (-2 -20))

----------------------
This shows delimited continuations works in combination with interleaving and zip constructs
(zip evaluates all it's argumets in parallell). And I claim that the continuation is first class and can be used soundly everywhere above the <prompt> construct. I documented it in the guile-log manual for anyone interested in using this. To note is that this constructs is first class and should work quite well with all features of guile-log e.g. It will work well with zip like constructs, interleaving construct, postpone, storing and restarting and all accumulator constructs. Also it is really efficient in many ways and contains optimization for handling breath first search with storing a huge number of continuation points in e.g. the postpone construct.

There is published paper from this year about non first class continuations in prolog ontop WAM.

Probably guile-log should be documented and published as a scientific paper, anybody interested in mentoring such an effort?

I will continue with implementing iso-prolog next and then do a release.

Happy Hacking



reply via email to

[Prev in Thread] Current Thread [Next in Thread]