Hi Henrique,

Do you need more than what this code does?
This example does not interfere with rule firing order or fool with
salience.


;;;;;;;;;;;;;;
;; focus.clp
;;;;;;;;;;;;;;

(clear)
;(watch all)

(defmodule module-1)

(defrule in-module-1
   =>
   (printout t "Now in module-1" crlf))

(defmodule module-2)

(defrule in-module-2
   =>
   (printout t "Now in module-2 and asserting a (foo)" crlf)
   (assert (MAIN::foo)))

(defmodule module-k)

(defrule in-module-k
   =>
   (printout t "Now in module-k" crlf))

(defmodule module-controller)

(defrule switch-to-module-k
    (declare (auto-focus TRUE))
    (MAIN::foo)
=>
    (printout t "Foo detected in MAIN ... switching to module-k now!" crlf)
    (focus module-k))

(defmodule module-n)

(defrule in-module-n
   =>
   (printout t "Resuming focus stack in module-n" crlf)
   (halt))

; Program
(reset)
(focus module-1 module-2 module-n)
(run-until-halt)

/**
OUTPUT
Jess> (batch "focus.clp")
Now in module-1
Now in module-2 and asserting a (foo)
Foo detected in MAIN ... switching to module-k now!
Now in module-k
Resuming focus stack in module-n
5
**/

Cheers,
Jason



On Fri, Mar 14, 2008 at 8:41 AM, Henrique Lopes Cardoso <[EMAIL PROTECTED]>
wrote:

> Hi,
>
> Some time ago I discussed the possibility of using auto-focus in a
> module definition, instead of in each single rule in a module.
> I was told that was not possible, but that it was a good idea.
>
> Are you planning to include this feature?
> This would be interesting especially when using modules merely as a way
> of organizing rules, while not interfering with rule-firing order, and
> not messing up with salience.
>
> Henrique
>
>
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>
>


--
-----------------------------------------------------------
Jason Morris
Morris Technical Solutions LLC
http://www.morris-technical-solutions.com

Reply via email to