guile-devel
[Top][All Lists]
Advanced

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

Re: guarding functional datastructures in guile log


From: Stefan Israelsson Tampe
Subject: Re: guarding functional datastructures in guile log
Date: Wed, 8 Jan 2014 23:05:35 +0100

ops, I pushed the wrong buttons,

But I need to use another email client, the one I use kills my creativity, until then
Happy Hacking

On Wed, Jan 8, 2014 at 11:03 PM, Stefan Israelsson Tampe <address@hidden> wrote:
Christmas holliday's has ended and a good progress has been made, mostly coding an 
iso prolog to be used with guile and guile-log. I use two test repos and most of the
tests are passing. I will not head for passing all tests because I do not want to reuse
the number tower of guile as well as the module code base.

But I would like to produce some code for people to peek at and actually have
some scheme code to show, and not a bunch of words that doesn't make sense.

So here is the issue. It would be nice to have datastructures in prolog/kanren that
i)   backtracks at will or not
ii)  faster then lists
iii) can redo and undo cleanly in order to support the more advanced constructs
=================================================================

One of the drivers to do this is that the prolog way of keeping state across
backtrackings e.g. data that does not backtrack is via dynamic functions. But the path
taken in guile-log is to have a datastructure for dynamic functions that is compiling e.g. they are fast to execute but slow to modify. The solution is to supply alternative objects that can
be used in stead of dynamic functions.

Guile-log generally head for functional datastructures but that is not enough, backtracking put a severe stress on many functional datastructures like vhashes and if one can prove that the backtracking is done without stored state, then they may take a shortcut. 

Also refering to a global variable can make code much cleaner, we will show how we can allow that later.

So, consider the task of managing a hash for a logical program. we could start modelling this ontop of vhashes e.g.

(define (make-prolog-hash) vlist-null)
(define* (prolog-hash-ref h k #:optional (e #f))
   (let ((r (vhash-assoc h k)))
       (if r
           (cdr r)
           




reply via email to

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