hi All,
we had a brain teaser at work and i'm using it to teach myself jess.
I need to be able to compare two instances of facts from the same
DefTemplate.
I tried:
(deftemplate solution
(slot position)
(slot bottle)
)
(bind ?*a* (assert (solution
(position a)
(bottle wine)))
)
(bind ?*b* (assert (solution
(position b)
(bottle cola)))
)
(defrule n01
((call ?*a* getName) (bottle wine))
((call ?*a* getName) (position a))
((call ?*b* getName) (bottle cola))
((call ?*b* getName) (position b))
=>
(bind ?*status* -1)
)
I want to test for,
"if the wine bottle is in position a, then the cola bottle cannot be in
position b"
The above two asserted facts would cause the rule to fire, setting status to
-1, alerting me to the mismatch.
But, the above rule excepts. The (call ?*a*) is not adequate for retrieving
the particular instance of the rule i am looking for. Substituting
'solution' for 'call ?*a*' doesn't work, b/c then it doesn't allow me to
differentiate between instances.
Any guidance would be most welcome.
Thanks,
mark
---------------------------------------------------------------------
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]
---------------------------------------------------------------------