title: CLIPS rule to print messages in descending order
body: <p>I need some help with a CLIPS question. This is the problem:</p>
  
  <p>"Assume that a CLIPS database contains facts that are instantiations of the following template:</p>
  
  <pre><code>(deftemplate recommendation
       (slot name)
       (slot message)
       (slot rating)
  )
  </code></pre>
  
  <p>Write CLIPS rule to print messages in descending order according to rating. Each message is to be printed along with its associated name and rating."</p>
  
  <p>I know the sort rule when there is a list such as:</p>
  
  <pre><code>(deffacts testlist
          (list 1 4 2 3 5 8 7 6 9 0)
      ) 
  
  (defrule sort
  
           ?f &lt;- (list $?head ?a ?b&amp;:(&lt; ?b ?a) $?tail)
  =&gt;
      (retract ?f)
  
      (assert (list $?head ?b ?a $?tail))
  )
  </code></pre>
  
  <p>But I am not sure when is it in the deftemplate format. Can someone help please?</p>