A Jess lambda is a closure (more or less.) You can use variables from
the enclosing scope. Here I am calling "printout" in a new thread, to
print a variable defined in the current scope:
;; Define a variable
(bind ?message "Hello, world!")
;; Print it in a new thread
((new Thread (implement Runnable using
(lambda ($?) (printout t ?message crlf)))
) start)
You'd just call your Userfunction instead of calling "printout".
On Feb 17, 2009, at 3:52 PM, Matt Hutchinson wrote:
OK, thanks. However I am using a Userfunction - which takes a couple
of parameters. How do I start the new thread for it and pass it the
parameters?
The only way to do this was with constructor parameters, but the
Userfunction uses command line parameters.
Thanks
MH
On Thu, Feb 12, 2009 at 12:51 PM, Ernest Friedman-Hill <[email protected]
> wrote:
Rules are fired sequentially, on the thread where you call "run". If
you want asynchronous execution, you could create a thread and run
your code off in its own thread. CHek out the "implement" function
in the "Jess Function List" chapter of the manual for an example of
this.
On Feb 12, 2009, at 11:20 AM, Matt Hutchinson wrote:
Hi everyone,
I did search on this but could not find an answer.
When multiple rules fire in JESS, it is JESS who decides the order
in which they fire - no worries. Although these fire in some order,
does the RHS of the first have to finish before the RHS of the next
rule is executed, and so on?
I was hoping that if several rules fire, their RHSs are all executed
one they fire, without any waiting (somewhat in parallel).
Thanks,
MH
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012 [email protected]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
.
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com
--------------------------------------------------------------------
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].
--------------------------------------------------------------------