f7b7440c46ff

Clean up the rule UI too
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 06 Jul 2016 20:08:27 +0000
parents 0955ab257fef
children 55019395ba93
branches/tags (none)
files src/wam/ui.lisp

Changes

--- a/src/wam/ui.lisp	Wed Jul 06 18:30:31 2016 +0000
+++ b/src/wam/ui.lisp	Wed Jul 06 20:08:27 2016 +0000
@@ -17,24 +17,24 @@
 
 
 ;;;; Assertion
-(defun add-rule (clause)
-  (wam-logic-frame-add-clause! *database* clause)
+(defun invoke-rule (head &rest body)
+  (wam-logic-frame-add-clause! *database* (list* head body))
   (values))
 
-(defun add-fact (fact)
-  (add-rule (list fact))
+(defun invoke-fact (fact)
+  (invoke-rule fact)
   (values))
 
-(defun add-facts (facts)
+(defun invoke-facts (&rest facts)
   (mapc #'add-fact facts)
   (values))
 
 
-(defmacro rule (&body body)
-  `(add-rule ',body))
+(defmacro rule (head &body body)
+  `(invoke-rule ',head ,@(loop :for term :in body :collect `',term)))
 
 (defmacro fact (fact)
-  `(add-fact ',fact))
+  `(invoke-fact ',fact))
 
 (defmacro facts (&body facts)
   `(progn