You can handle the "run continuously" part using the "slot-specific" declaration in the "trial" deftemplate; see http://www.jessrules.com/ jess/docs/70/rules.html#slot-specific .

As far as the single value, that's because each modify call sets the slot to contain a single item, the sum of ?x and ?b. If you want to accumulate a set of values in a slot, you need to save all the values in a list, and then call modify once, at the end.


On Nov 14, 2006, at 6:45 PM, Soil inf. wrote:


For starters I am trying to add multislot values to a 2nd single slot value and store the outcome in a third multislot. Eventually i will be trying to add two multislot fields together, with all possible combination outputs
stored in a third multislot.
The following example runs but doesnt complete (it runs continuously). If i run a step (run 1) then i only get one value, the last one evaluated, saved
to multislot c.
(deftemplate trial
        (multislot a)
        (slot b)
        (multislot c))

(deffunction trial1 (?a ?b)
        (foreach ?x ?a
                (bind $?y(+ ?x ?b))
                (printout t ?y crlf)
                (modify 1 (c $?y))))
(defrule PTF
        (trial (a $?x) (b ?b))
=>
        (trial1 ?x ?b))
(reset)
(assert (soil (a 1 2 3) (b 5)))
--
View this message in context: http://www.nabble.com/multislot- __data-question-tf2146010.html#a7349169
Sent from the Jess mailing list archive at Nabble.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 owner-jess- [EMAIL PROTECTED]
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
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]
--------------------------------------------------------------------

Reply via email to