(clear) 

(deftemplate foo 
  (multislot a)
  (slot x)
  (multislot b)
  (slot y))
  
(defrule bar 
   (foo (a $?a) (b $?b) (x ?x) (y ?y))
   =>
   (printout t ?a " " ?b " " ?x " " ?y crlf))
(reset)
(assert (foo))          
(duplicate 1 (a) (b) (x 8))
(duplicate 1 (a) (b 1) (x 8))
(duplicate 1 (a 1) (b) (x 8))
(duplicate 1 (a 1) (b 1) (x 8))
(duplicate 1 (a 1 2) (b 3 4 5) (x 8))
(facts)
(run)
(reset)
(assert (foo (a) (b) (x 1) (y 2)))
(duplicate 1 (a) (b) (x 8))
(duplicate 1 (a) (b 1) (x 8))
(duplicate 1 (a 1) (b) (x 8))
(duplicate 1 (a 1) (b 1) (x 8))
(duplicate 1 (a 1 2) (b 3 4 5) (x 8))
(facts)
(run)
(reset)
(assert (foo (a 1) (b 2) (x 3) (y 4)))
(duplicate 1 (a) (b) (x 8))
(duplicate 1 (a) (b 1) (x 8))
(duplicate 1 (a 1) (b) (x 8))
(duplicate 1 (a 1) (b 1) (x 8))
(duplicate 1 (a 1 2) (b 3 4 5) (x 8))
(facts)
(run)
(reset)
(assert (foo (a 1 2) (b 3 4 5) (x 6) (y 7))) 
(duplicate 1 (a) (b) (x 8))
(duplicate 1 (a) (b 1) (x 8))
(duplicate 1 (a 1) (b) (x 8))
(duplicate 1 (a 1) (b 1) (x 8))
(duplicate 1 (a 1 2) (b 3 4 5) (x 8))
(facts)
(run)
(reset)
(watch facts)
(assert (foo (a) (b) (x 1) (y 2))) 
(modify 1 (a 1))
(modify 2 (b 1))
(modify 3 (a 1 2))
(modify 4 (b 1 2 3))
(modify 5 (a))
(modify 6 (b 1))
(modify 7 (a 1) (b 1 2))
(modify 8 (a 1 2) (b))
(modify 9 (a) (b))
(unwatch facts)
