Here is the code so perhaps you can see my mistake more easily or at least what I'm doing wrong:
(deftemplate Patient
"Patient Information"
(slot rule
(type STRING)
(default "-"))
(slot age
(type INTEGER)
(default 30))
(slot location
(type STRING)
(default "-"))
(slot full-time_education
(type ATOM)
(default No))
)
(deffunction under-16 ()
(printout t "How old are you?")
(assert (Patient (age (read)))))
(defrule eligibility-rule1
(Patient (rule ?rule) (age ?age&
< ?age 16)))
=>
(printout t "You are eligible for free prescriptions. (Rule: " ?rule ")" crlf) )
(defrule eligibility-rule2
(Patient (rule ?rule) (age ?age&
< ?age 25)) (location "Wales"))
=>
(printout t "You are eligible for free prescriptions. (Rule: " ?rule ")" crlf) )
(defrule eligibility-rule3
(Patient (rule ?rule) (age ?age&
< ?age 19)) (full-time_education Yes))
=>
(printout t "You are eligible for free prescriptions. (Rule: " ?rule ")" crlf) )
(defrule eligibility-rule4
(Patient (rule ?rule) (age ?age&
> ?age 59)))
=>
(printout t "You are eligible for free prescriptions. (Rule: " ?rule ")" crlf) )
Is this what you intended? When I run it it just returns 0 no matter what age value I enter! Your help is much appreciated and unfortunately I don't have the text.
[ December 01, 2005: Message edited by: Jonathan Goode ]