I think that Bhaskar wrote: >>Can you give me an example of control-patterns?
Hi Bhaskar, Sure thing. Try saving and running this batch file. ==================================================== (clear) (watch all) (defrule rule-1 "Fires only if a (control-1) fact is present." ;; You might have several of these controlling the application state ?previous-control <-(control-1) ;; Put other patterns here in your real code. => ;; Put other function calls here in your real code. (retract ?previous-control) (assert (control-n))) ;; And you may have many rules in this module ;; all working on some task... (defrule rule-n "Fires only if a (control-n) fact is present." ?previous-control <-(control-n) ;; Put other patterns here in your real code. => ;; Put other function calls here in your real code. (retract ?previous-control) (assert (process-done))) ;; Have the last rule done please turn off the lights :-D (defrule process-is-done "Fires only if process is complete." (process-done) ;; Put other patterns here if needed. => ;; Put other function calls here if needed. ;; Begin the next process or halt (printout t "Process is finished." crlf)) ;; Test (reset) (assert (control-1)) (run) =========================================== Jess prints out the following.... Jess> (batch cc.clp) MAIN::rule-1: +1+1+1+t MAIN::rule-n: +1+1+1+t MAIN::process-is-done: +1+1+1+t ==> Focus MAIN ==> f-0 (MAIN::initial-fact) ==> f-1 (MAIN::control-1) ==> Activation: MAIN::rule-1 : f-1 FIRE 1 MAIN::rule-1 f-1 <== f-1 (MAIN::control-1) ==> f-2 (MAIN::control-n) ==> Activation: MAIN::rule-n : f-2 FIRE 2 MAIN::rule-n f-2 <== f-2 (MAIN::control-n) ==> f-3 (MAIN::process-done) ==> Activation: MAIN::process-is-done : f-3 FIRE 3 MAIN::process-is-done f-3 Process is finished. <== Focus MAIN 3 Jess> Hope this helps! Cheers, Jason ------------------------ Jason Morris Morris Technical Solutions [EMAIL PROTECTED] www.morristechnicalsolutions.com fax/phone: 503.692.1088 -------------------------------------------------------------------- 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] --------------------------------------------------------------------