(deftemplate tea (multislot category (type SYMBOL) ) (slot test (type SYMBOL)) (slot ingredient (type SYMBOL) (default sugar)) (slot recipe (type SYMBOL) ) (deffacts tea_categories (tea (categories black) (test bitter) (ingredients water,sugar) (recipe ice tea latte) (tea (categories green) (test sweet) (ingredients milk,sugar) (recipe organic green tea with ginger) (tea (categories oolong originate ) (test sweet) (ingredients milk,sugar) (recipe iced caramel cream) (tea (categories herbal ) (test bitter) (ingredients water,sugar) (recipe nerada shearer's fruit tea cake) ) (defrule ask-test (declare (salience 100)) (initial-fact) => (printout t "Please enter the tea characteristics:" crlf) (printout t "recipe (ice tea latte,organic green tea with ginger,iced carmel cream,nerada shearer's fruit tea cake) :") (bind ?ans1 (read)) (printout t crlf "ingredient (sugar,water,milk) :") (bind ?ans2 (read)) (printout t crlf "test (bitter or sweet) :") (bind ?ans3 (read)) (assert (tea (category users) (recipe ?ans1) (ingredients ?ans2) (test ? ans3))) ) (defrule category (declare (salience 10)) (tea (category users) (test ?t) (ingredients ?i) (recipe ?r)) (tea (category ?c&:(neq ?c users))(test ?t) (ingredients ?i) (recipe ?r)) => (printout t "You've got a " ?c crlf) (halt) )