At 09:55 18-7-02 -0700, you wrote:
>You can certainly bind it to a variable on the LHS of the get-A rule,
>then retract it yourself on the RHS.  I recall, dimly, that when I
>first implemented BC in Jess, the need-A facts would be automatically
>retracted, but that turned out to be bad for a reason that I can't
>remember right now. Anybody?

Maybe it's because other rules that contain need-A will lead to a different 
value of A and you don''t want to exclude that possibilities on forehand.
Anyway, retracting the need-A fact didn't work in my example. The problem 
is that the need-B fact is already set and it will fire the get-B rule:

(do-backward-chaining A)
(do-backward-chaining B)
(do-backward-chaining C)
(defrule succeed-A

(A ?)
=>
(printout t A))

(defrule get-A
?a <- (need-A ?)
(B ?b)
(test (eq ?b True))
=>
(assert (A True))
(retract ?a))

(defrule get-A2
?a <- (need-A ?)
(C ?c)
(test (eq ?c True))
=>
(assert (A True))
(retract ?a))

(defrule get-C
(need-C ?)
=>
(printout t "c?")
(assert (C (read))))

(defrule get-B
(need-B ?)
=>
(printout t "b?")
(assert (B (read))))

(reset)
(run)

A possibility is though to put an extra need-A claim in the body of get-B 
and get-C so they won't be fired if A isn't needed anymore.
A drawback of this is that you if want to use the get B-rule for different 
decision-tree branches (that is: more conclusions that just A), you have to 
a get-B for each one of the branches.
Anyone got another idea to solve this?

Greetz,
Jeroen

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