Hello everybody,
 
Suppose that I have the following template:

(deftemplate MAIN::My-Template 
  (slot id (type INTEGER))
  (slot index1 (type INTEGER)) 
  (slot index2 (type INTEGER)))
 

I want a rule that would be activated by the fact with the greatest index1 
*and* the smallest index2. Note that index1 and index2 *are not* unique.
 

So let's say that these facts are in the working memory:
(assert (MAIN::My-Template 
  (id 1) (index1 1) (index2 0))
(assert (MAIN::Queue 
  (id 2) (index1 1) (index2 0))
(assert (MAIN::Queue 
  (id 3) (index1 0) (index2 0))

 
The rule would fire either with the first (id 1) or second (id 2) fact.
 
And now let's say that these facts are in the working memory:
(assert (MAIN::My-Template 
  (id 1) (index1 1) (index2 -1))
(assert (MAIN::Queue 
  (id 2) (index1 1) (index2 0))
(assert (MAIN::Queue 
  (id 3) (index1 0) (index2 0))

 
The rule would fire only with the first fact (id 1).
 

How can I write this kind of rule?

 
Thanks in advance.

 
Nicolas
_________________________________________________________________
Envoie un sourire, fais rire, amuse-toi! Employez-le maintenant!
http://www.emoticonesgratuites.ca/?icid=EMFRCA120

Reply via email to