Depends where the list is. If it's in a multislot in a fact like

  (numbers 1 2 3 4)

then just write the rule like

(defrule processList
  (numbers $? ?itemInList $?)
  =>
  (printout t ?itemInList crlf))

If, on the other hand, "I have a list" means that in some procedural
code, you have a list of items, then don't bother writing a rule --
just write a loop. The "foreach" function will actually do the looping
for you:

(foreach ?itemInList (create$ 1 2 3 4)
     (printout t ?itemInList crlf))

I think colin harris wrote:
> Hi,
> 
> I have a List of items say  [1 2 3 4] and i want to get a Rule to fire for 
> each item in the List. Any help on how this might be done would be much 
> appreciated.
> 
> (defrule processList  (SOMETHING HERE??) => (printout t ?itemInList crlf))
> 
> regards
> colin harris
> 




---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [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
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to