Simply write a rule

(defrule process-meals
   ?m <- (meal (name ?name) (time ?time) ...)
=>
   ;; now process this one meal
)

the rule will fire once for each (meal) fact. This is how rule-based
systems work.

I think Christo Andonyadis wrote:
> 
> I am trying to use some of the many features of Jess.
> The manual has few example to go by.
> If I have:
> 
> (deftemplate meal
>    (slot name)
>    (slot time)
>    (slot calories)
>    (slot fats)
>    (slot carbos)
>    (slot prots)
> )
> 
> I have other rules that assert instances of this template:
> 
> (assert (meal (name breakfast) (time 0830) (cals 350) (fats 45) (carbos
> 205) (prots 100)))
> 
> (assert (meal (name lunch) (time 1230) (cals 550) (fats 95) (carbos 255)
> (prots 200)))
> 
> I would like to use a foreach to go through each meal and do some
> processing:
> 
> (defrule
>    (meal ?all)
>    =>
>    (foreach ?all
>       (printout t "Meal: " name time cals fats carbos prots)
>    )
> )
> I know this isn't right, but am I going in the right direction?
> I guess the answers to these questions would be in the CLIPS manual?
> I can't find mine at the moment.
> 
> Thanks
> Christo
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to