anchor.diff:        (values *query-result* ?name))))
   
   (defun define-query (name body)
  +  "The actual query definition function. Creates a RULE instance identified by
  +  the symbol NAME, with BODY as its LHS and RHS, and adds the new rule to the
  +  rete network."
     (let ((rule (define-rule name body)))
       (add-rule (current-engine) rule)
       (values rule)))
   
   (defmacro defquery (name &body body)
  +  "Defines a new query identified by the symbol NAME."
     `(define-query ,name ',body))
   
   (defmacro retrieve ((&rest varlist) &body body)
  +  "Issues a query against the knowledge base. First, the query body is
  +  normalized to produce a hash code. Next, the cache is checked to see if the
  +  query already exists; if it doesn't, then a new query (rule) is created,
  +  cached and added to the rete network. Finally, the query is run."
     (flet ((make-query-binding (var)
              `(cons ',var (instance-of-shadow-fact ,var))))
       (let ((query-name (gensym))
             (hash (gensym))
             (query (gensym)))
         `(let* ((,hash (sxhash (normalize-query ',body)))
  +              (,query-name (gensym))
                 (,query (find-query ,hash)))
            (when (null ,query)
              (setf ,query
  
positive.code: ;;; Description: Macros and functions implementing LISA's initial query
  ;;; language implementation.
  
  ;;; $Id: retrieve.lisp,v 1.13 2002/04/08 20:12:46 youngde Exp $
  
  (in-package "LISA")
  
  
negative.code:               (remove-query key value))))))))
  
  (defun remember-query (hash query)
    "Binds the name of QUERY (a RULE instance) to HASH by entering it into the
    hash table *QUERY-MAP*."
    (setf (gethash hash *query-map*) (get-name query)))
  
  (defmethod clear-engine :after ((self rete))
    "Removes all queries from *QUERY-MAP* whenever an inference engine is
    CLEARed."
    (forget-all-queries))
  
  (defun find-query (hash)
    "Looks up a query name in the local query table *QUERY-MAP*, indexed by
    HASH. Then, attempts to resolve that name to a rule instance in the current
    inference engine."
    (let ((query-name (gethash hash *query-map*)))
      (if (not (null query-name))
          (progn
  