Actually, yes.
I mean, I can do exactly what I need with auto-focus in rules dispersed
among a number of modules.
I was just emphasizing that if you use modules with a merely
organizational aim (in which rules are concerned), it would be more
simple to do something like:
(defmodule m
(declare (auto-focus TRUE)) )
which would mean that *every* rule in module 'm' would have auto-focus.
This is not possible for now.
Henrique
Jason Morris wrote:
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]
<mailto:[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]
--------------------------------------------------------------------