# HG changeset patch # User Steve Losh # Date 1467997434 0 # Node ID 2415dbe555d278172e01dc710dc55130fda19614 # Parent 55019395ba9368e7bcf1cf869e8561f63e65f259 Export symbols and add a few sanity checks diff -r 55019395ba93 -r 2415dbe555d2 package.lisp --- a/package.lisp Wed Jul 06 20:41:56 2016 +0000 +++ b/package.lisp Fri Jul 08 17:03:54 2016 +0000 @@ -1,6 +1,3 @@ -(defpackage #:bones - (:use #:cl) - (:export #:hello)) (defpackage #:bones.utils (:use @@ -69,6 +66,42 @@ #:bones.circle #:bones.quickutils #:bones.utils) + (:export + #:make-database + #:with-database + #:with-fresh-database + + #:invoke-rule + #:invoke-fact + #:invoke-facts + + #:rule + #:fact + #:facts + + #:push-logic-frame + #:pop-logic-frame + #:finalize-logic-frame + #:push-logic-frame-with + + #:invoke-query + #:invoke-query-all + #:invoke-query-map + #:invoke-query-do + #:invoke-query-find + #:invoke-prove + + #:query + #:query-all + #:query-map + #:query-do + #:query-find + #:prove + + #:call + #:? + #:! + ) (:import-from #:optima #:match) (:shadowing-import-from #:cl-arrows @@ -110,3 +143,45 @@ #:query-one #:query-all)) + + + +(defpackage #:bones + (:use #:cl #:bones.wam) + (:export + #:make-database + #:with-database + #:with-fresh-database + + #:invoke-rule + #:invoke-fact + #:invoke-facts + + #:rule + #:fact + #:facts + + #:push-logic-frame + #:pop-logic-frame + #:finalize-logic-frame + #:push-logic-frame-with + + #:invoke-query + #:invoke-query-all + #:invoke-query-map + #:invoke-query-do + #:invoke-query-find + #:invoke-prove + + #:query + #:query-all + #:query-map + #:query-do + #:query-find + #:prove + + #:call + #:? + #:! + + )) diff -r 55019395ba93 -r 2415dbe555d2 src/wam/ui.lisp --- a/src/wam/ui.lisp Wed Jul 06 20:41:56 2016 +0000 +++ b/src/wam/ui.lisp Fri Jul 08 17:03:54 2016 +0000 @@ -35,6 +35,7 @@ ;;;; Assertion (defun invoke-rule (head &rest body) + (assert *database* (*database*) "No database.") (wam-logic-frame-add-clause! *database* (list* (normalize-term head) (mapcar #'normalize-term body))) @@ -62,12 +63,15 @@ ;;;; Logic Frames (defun push-logic-frame () + (assert *database* (*database*) "No database.") (wam-push-logic-frame! *database*)) (defun pop-logic-frame () + (assert *database* (*database*) "No database.") (wam-pop-logic-frame! *database*)) (defun finalize-logic-frame () + (assert *database* (*database*) "No database.") (wam-finalize-logic-frame! *database*)) (defmacro push-logic-frame-with (&body body) @@ -79,6 +83,7 @@ ;;;; Querying (defun perform-query (terms result-function) + (assert *database* (*database*) "No database.") (run-query *database* (mapcar #'normalize-term terms) :result-function result-function))