Executing the following code does not produce what I expected.
--------------------------------------------------
(clear)
(watch rules)
(watch activations)
(watch facts)
(deftemplate thing
(slot a)
(slot b)
)
(deftemplate work
(slot a)
(slot blist)
)
(reset)
(assert (work (a 0) (blist (create$))))
(assert (thing (a 1) (b x)))
(assert (thing (a 2) (b y)))
(assert (thing (a 3) (b z)))
(defrule workrule
?f1<-(thing
(a ?a1)
(b ?b)
)
?f2<-(work
(a ?a2)
(blist $?list)
)
=>
(retract ?f1)
(modify ?f2
(a (max ?a1 ?a2))
(blist (create$ $?list ?b))
)
)
(run)
(facts)
--------------------------------------------------
Jess> (batch multitest.clp)
==> f-0 (MAIN::initial-fact)
==> f-1 (MAIN::work (a 0) (blist ))
==> f-2 (MAIN::thing (a 1) (b x))
==> f-3 (MAIN::thing (a 2) (b y))
==> f-4 (MAIN::thing (a 3) (b z))
==> Activation: MAIN::workrule : f-2, f-1
==> Activation: MAIN::workrule : f-3, f-1
==> Activation: MAIN::workrule : f-4, f-1
FIRE 1 MAIN::workrule f-4, f-1
<== f-4 (MAIN::thing (a 3) (b z))
<== Activation: MAIN::workrule : f-2, f-1
<== Activation: MAIN::workrule : f-3, f-1
==> Activation: MAIN::workrule : f-2, f-1
==> Activation: MAIN::workrule : f-3, f-1
FIRE 2 MAIN::workrule f-3, f-1
<== f-3 (MAIN::thing (a 2) (b y))
<== Activation: MAIN::workrule : f-2, f-1
==> Activation: MAIN::workrule : f-2, f-1
FIRE 3 MAIN::workrule f-2, f-1
<== f-2 (MAIN::thing (a 1) (b x))
f-0 (MAIN::initial-fact)
f-1 (MAIN::work (a 3) (blist z))
For a total of 2 facts.
Jess>
Note that the blist slot in the work fact does not contain (x y z) as I
would expect. Breaking the modify into a retract and assert generates the
expected results. Is this a bug? I am running 6.0. I'd like to use the
modify because my real code has a lot slots in the 'work' fact.
Dave
--------------------------------------------------------------------
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]
--------------------------------------------------------------------