I think [EMAIL PROTECTED] wrote: > Hello - > > I am trying to define a rule to find the facts for which the value in a > variable is one of the values within a multislot within the fact. Specifically: > > (defrule illness-is > ?fact-id <- (illness (symptoms $?s&:(member$ ?user-symptom $?s))) > => > (printout t "You may have " (fact-slot-value ?fact-id name) crlf) > ) > > But Jess doesn't like the use of ?user-symptom variable. I get the following > error: > > Jess reported an error in routine ReteCompiler.eval. > Message: Unbound variable found in funcall: user-symptom .
Indeed. I guess you're trying to match against a "top-level" variable, and you can't do that. You can do one of two things: you can use a defglobal (see manual section 2.3.1.) which would let you code things essentially the way you already have done. Note, however, that matches against defglobals are evaluated when facts are retracted, asserted or modified; changing the value of a defglobal doesn't redo the matching. The other thing you can do is to assert the value as a fact, and that's actually what I'd recommend; i.e., when you read the value for ?user-symptom, assert a fact (user-symptom ?user-symptom), and match against this fact. --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
