Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jess Query #2

 
Jonathan Goode
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hate to be a pain but Ernest replied to my first Jess Query and then moved my post to "Other Java Products and Servers" but as far as I can see that part of the forum is rather dead and I am really anxious to get a reply from Ernest or anyone else who can help. Here is my code and what I'm hoping to do:

(deffunction under-16 ()
(printout t "How old are you?")
(assert (Patient(age (read)))))

then to modify at a later stage:

(modify 1(Patient(age (read))))
(modify 1(Patient(location (read))))
etc...

I want to create a function which asks a question such as "How old are you?" and then get Jess to compare the integer entered with the criteria specified in my rule(s). I already have a template called Patient with a slot named age. When I use the above it just gives 0. Here is my first rule:

(defrule eligibility-rule1
(Patient (age ?age& < ?age 16)))
=>
(printout t "You are eligible for free prescriptions. (Rule: 1)" crlf) )

Thanks a million.
[ December 01, 2005: Message edited by: Jonathan Goode ]
 
Jonathan Goode
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for your help. I've managed to get it all working - just in time for my hand in date of tomorrow! Topic can be closed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic