Hi,

I'm starting with JESS and stumbled on a problem.

The following rule is supposed to activate when a person have exactly 3
objects. (there is exactly 3 facts "person-have-object"):

(defrule person-have-3-objects
    (person-have-object ?person ?object1)
    (person-have-object ?person ?object2)
    (person-have-object ?person ?object3)
    =>
    (printout t ?object1 ?object2 ?object3))

In the LHS, I want to express the fact that person-have-object is found
exactly 3 times for a unique person in the facts database. And I'd like to
have a reference to each object for operation in the RHS.

I thought that my LHS was correct but it matches when there is only 1 fact
(person-have-object myself computer). It will prints "computer computer
computer".

How can I explicitly state that I want ?object1, ?object2 and ?object3 to be
different?

Thank you,

--
Jean-Francois Lassonde

Reply via email to