Q = (A/B)c n (C/D)c = (B u Ac) n (C u Dc) = .. It implements complementable set and setmaps from different underlying vhash datastructures.as before
@node implementations
@sqection implementations
@section implementations
This api is reached from @code{(ice-9 vset)}. It implements complementable set and setmaps from different underlying vhash datastructures.
@section API
...
...
@@ -2210,7 +2210,114 @@ order? : if ordering of this key is important
@node inheritance
@chapter inheritance
a
Consider a set of objects and that we can add arrow links between the objects that forms a forest of acyclic directed graphs. This is the same as defining a multiple inheritance relation to the objects. What we can compile is lookup structures that enables fast understanding if one object is an ancester to another object or not, use function @code{compile-sup-sub}. and vice versa. Another useful lookup structure origiates from associating each set obect with a value and then ask for all objects of an object and all it's decendants. This is a kind of tree lookup and one needs to reorder the objects to enable an effective lookup, this is dine in the special compiliation function, @code{compile-set-representation} or @code{order-the-set}. It's possible to build a search tree through function @code{mktree}. To use this lookup tree one can use @code{fold-matching-sets} which folds all decendants from a paren set object.
@chapter API
@verbatim
this code is found in (logic guile-log inheritance)
scm (make-set-theory) : make a fresh new set theory
scm (make-set-theory parent) : make a new set theory with parent theory
fluid *current-set-theory* : contains current set theory
scm (print-theory) : print current set theory
scm (print-theory th) : print theory th
scm (new-set set) : add a new set element to the current theory
scm (new-set theory set) : add a new set element to the theory and
return it
scm (lookup set) : lookup set object o's coding from current
theory
scm (lookup theory set) : lookup set object o's coding from theory
scm (reverse-lookup set) : lookup the set object from coding using
current theory
scm (reverse-lookup theory set) : lookup the set object from coding using
theory
scm (a->b a b) : add an arrow link from a to b in current
theory
scm (a->b theory a b) : add an arrow link from a to b in theory and
retrun the new theory
scm (a->b-o a b) : add an arrow link from a to b in current
theory and update parenthood information
assuming that all perents have no parent yet.
scm (a->b-o theory a b) : add an arrow link from a to b in theory
and update parenthood information assuming
that all perents have no parent yet. returns
the new theory.
scm (compile-sup-sub) : compile the parenthood information in current
theory
scm (compile-sup-sub theory) : compile the parenthood information theory
and return the new theory.
scm (compile-set-representation) :
compile all remaining datastructures for inheritance analysis using all
set objects in current theory.
scm (compile-set-representation setbits) :
compile all remaining datastructures for inheritance analysis using all
set objects in setbits in current theory.
scm (compile-set-representation theory) :
compile all remaining datastructures for inheritance analysis using all
set objects in theory.
scm (compile-set-representation theory setbits) :
compile all remaining datastructures for inheritance analysis using all
set objects in setbits in theory.
scm (order-the-set) :
compile all remaining datastructures for inheritance analysis using all
set objects in current theory. updates current theory
scm (order-the-set theory) :
compile all remaining datastructures for inheritance analysis using all
<p>Guile log sports full garbage collection of logical variables which makes it suitable to run server like prolog code. It is experimental but working. Unfourtunately the bdw-gc that guile uses does not allow this to work effectively and hence you need to download and replace the standard bdw-gc with a modified version of it. You may find it at
<p>Almost all of the kanren interface is implemented ontop of guile-log to use it import <code>logic guile-log kanren</code>. One could say that the kanren interface is the functional sister to guile-log which is more a macro framework as such guile-log is about 2x faster the kanren, but kanren has more beutifull semantics.
E.g. the kanren operation maps function arguments to functions. The kanren interface is divided into two categories of functionals, facts and relations. One combine facts into relations. The main difference is that fact functions have standardized arguments and relations have customized arguments. Also conversely evaluating the relation will return back a fact.
</p>
<aname="The-fact-building-blocks"></a>
<h3class="section">14.1 The fact building blocks</h3>
<h3class="section">15.1 The fact building blocks</h3>
<aname="index-succeed"></a>
<aname="index-fail"></a>
<aname="index-sfail"></a>
...
...
@@ -134,7 +134,7 @@ skipp multiples of similar sucesses e.g. if <code>(all f1 f2)</code> is a succes
<p><code>_</code>, produces a fress new logical variable in it’s place.
</p>
<aname="relations"></a>
<h3class="section">14.2 relations</h3>
<h3class="section">15.2 relations</h3>
<aname="index-relation"></a>
<aname="index-fact"></a>
<aname="index-extend_002drelation"></a>
...
...
@@ -202,7 +202,7 @@ variables <code>id ...</code>. E.g.
</p>
<aname="Queries"></a>
<h3class="section">14.3 Queries</h3>
<h3class="section">15.3 Queries</h3>
<aname="index-query"></a>
<aname="index-solve"></a>
...
...
@@ -215,7 +215,7 @@ variables <code>id ...</code>. E.g.
<p><code>(solution (v ...) g ...</code>, This is the same as <code>(solve 1 (v ...) g ...)</code>.
</p>
<aname="Misc"></a>
<h3class="section">14.4 Misc</h3>
<h3class="section">15.4 Misc</h3>
<aname="index-trace_002dvars"></a>
<aname="index-partially_002deval_002dsgl"></a>
...
...
@@ -224,7 +224,7 @@ variables <code>id ...</code>. E.g.
<p><code>partially-eval-sgl</code>, not implemented, because guile-log is also directed towards stacks and assq lists and hence usually uses another kind of implementation for the interleaving constructs.
<p>Guile log also sports an iso-prolog interface as a logic programming interface besides kanren. The interface is pretty complete at this point appart a few points that have not yet been resolved but sure it is currently alpha software and help is very very much appriciated. With this most programs written in iso prolog should probably work. The intention is to enhance this interface so that the bulk of already written prolog programs should be able to run on guile. We will also add the fetures unique to guile-log and hence enhance the prolog experience. Featurewise guile-log prolog is taking over many properties of scheme like closures, continuations, delimeted continuations, the interleaving constructs of kanren and a delicate system to treat dynamic objects like dynamic functions, dynamic hashes and a library to tell how you want the dynamism to work at a fine grained level.