title: How can I use deftemplate to store results in CLIPS?
body: <p>I was trying to build a template for storing some of the results I calculate, so I made this for initialization:</p>
  
  <pre><code>(deftemplate tempAlumne
      (slot nota-media-total)
      (slot nota-media-obligatorias)
      (slot nota-media-optativas)
      (slot nota-media-ales)
  )
  
  (deffacts tempAlumneFacts
      (tempAlumne 
          (nota-media-total -1)
          (nota-media-obligatorias -1)
          (nota-media-optativas -1)
          (nota-media-ales -1)
      )
  )
  </code></pre>
  
  <p>And then I'm trying to use that structure to store values, but I need it to be accesible from many rules, so I decided to make it global. So I tried to store values like this:</p>
  
  <pre><code>(defrule calcula-nota-media ""
      (not calcula-nota-media ok)
      ?*tmpA* &lt;- (tempAlumne )
  
      =&gt;
      (bind ?llista_convocs (send ?*alumne* get-IConvocatoria))
      (bind ?suma 0)
      (bind ?i 0) 
      (while(&lt; ?i (length$ ?llista_convocs)) do
          (bind ?convoc_actual (nth$ ?i ?llista_convocs))
          (bind ?suma (+ ?suma (send ?convoc_actual get-Nota)))
          (bind ?i (+ ?i 1))
      )   
      (/ )    
      (modify (?*tmpA* (nota-media-total (/ ?suma ?i))
      (assert calcula-nota-media ok)
  )
  </code></pre>
  
  <p>because I want ?*tmpA* to have the initial values and then assign each one with modify (here I assign nota-media-total), but it says "[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule.", so I don't know what is wrong or if I'm taking the wrong path.</p>