Next: , Previous: dynamic-functions, Up: Top


13 Database

Anything prolog like means that we need some kind of database for matching. And one such tool is included in guile-log. This is not a dynamic databas but one that we only can add elements and then compile and use it for lookup. It has some optimizations in it to be effective at looking the elements up still maintaining the introduced orders.

13.1 Api

Scm (make-matcher-env), this will make a matcher db object.

Scm (matcher-add db x y), this will add x->y in db this is nonfunctional object oriented way of treating db.

Scm (get-matcher-db db), yield the db inside the matcher.

Scm (compile-matcher), yield a compiled matcher for which we can work with. The resulting matcher will yield a list of nodes that matches a and that can be unified against in order to yield the prolog like db lookup.

G.L. (<db-lookup> db x y), this will lookup x in the compiled database db and yield y as a result of the stored pairs x->y.