Hi all,

Thank you for help on my last question which I have manged to get working
now. I have a basic question regarding shadow facts, which I can't seem to
find the answer to in Jess In Action. I basically have 4 dynamic shadow
facts which are updated from sensor input. I would like to calculate the
total of two of these inputs (specifically, the mass field of the bean), so
I would like to do something like:
(deffunction averageweight
 return (+ SmartCouch_LoadCellSensor1_MassEvent_Bean (mass))
SmartCouch_LoadCellSensor2_MassEvent_Bean (mass)))
)


Unfurtunately, I get the following error:

Jess reported an error in routine Jesp.parseDeffunction
        while executing (batch controller.clp).
  Message: Expected '(' .
  Program text: ( deffunction averageweight return  at line 7.
        at jess.Jesp.a(Unknown Source)
        at jess.Jesp.int(Unknown Source)
        at jess.Jesp.for(Unknown Source)
        at jess.Jesp.parse(Unknown Source)
        at jess.Jesp.parse(Unknown Source)
        at jess.Batch.batch(Unknown Source)
        at jess.Batch.call(Unknown Source)
        at jess.ep.a(Unknown Source)
        at jess.Funcall.execute(Unknown Source)
        at jess.Jesp.a(Unknown Source)
        at jess.Jesp.for(Unknown Source)
        at jess.Jesp.parse(Unknown Source)
        at jess.Rete.executeCommand(Unknown Source)
        at jess.Rete.executeCommand(Unknown Source)

On the other hand, accessing the ban in a rule with the following lhs works
fine:
(and
(SmartCouch_LoadCellSensor1_MassEvent_Bean (sensorID 1))
(SmartCouch_LoadCellSensor1_MassEvent_Bean (mass ?m&:(> ?m 5)))
)


I would really appreciate a quick pointer as to how I might use a dynamic
shadow fact in a deffunction.

Thank you for your time.

Greg

_____________________________________
Greg Biegel
Distributed Systems Group
Trinity College Dublin

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to