Next: , Previous: , Up: Top   [Index]


13 inheritance

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 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, compile-set-representation or order-the-set. It’s possible to build a search tree through function mktree. To use this lookup tree one can use fold-matching-sets which folds all decendants from a paren set object.

13.1 API

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
       set objects in theory.

scm   (mk-tree i->f #:key (setbits current-setmask))       :
      make a lookup tree using equal? hash-table, i->f, and including setbits
      mask in current theory

scm   (mk-tree theory i->f #:key (setbits theory-setmask)) :
      make a lookup tree using equal? hash-table, i->f, and including setbits
      mask in theory

scm   (set< x y) :
      checks if x is a parent of y in current theory

scm   (set< theory x y) :
      checks if x is a parent of y in theory

scm   (assoc=>tree theory a) :
      Take an assoc list and make a inherentance lookup tree for the values

scm   (find-matching-sets theory set tree) :
      find all decendants to set using the lookup structure tree in theory 

scm   (fold-matching-sets f seed set tree) :
      fold all decendand data for set (set-object value) using f and seed for 
      current theory and lookup tree tree. 
      (f set-object value seed) -> new seed

scm   (fold-matching-sets f seed theory set tree)
      fold all decendand data for set (set-object value) using f and seed for 
      theory and lookup tree tree.
      (f set-object value seed) -> new seed


Next: , Previous: , Up: Top   [Index]