CLIPS: How to evaluate multifield values as integers
<p>I'm struggling to evaluate properly the integer values of a multifield value.</p>

<p>Ultimately what I need is to pattern-match a multislot containing only integers and be able to tell if the "list" is in ascending order.</p>

<p>What I have so far:</p>

<pre><code>(defclass status 
    (is-a USER)
    (role concrete)
    (pattern-match reactive)
    (multislot numbers
        (create-accessor write)
        (type INTEGER) 
        (range 1 ?VARIABLE) 
        (default 1)
     )
)

(defrule asc
    ?st &lt;- (object (is-a status) (numbers $?n))
    (test (&gt; (length ?n) 2))
    (test (&lt; (first$ ?n) (rest$ ?n)))
=&gt; 
    (printout t "List " ?n " is ascending" crlf)
)

(make-instance of status (numbers 1 2 3))
</code></pre>

<p>I understand that probably that's not the way to expand a multislot and populate arguments for (&lt;) but I can't seem to find the right way.
And even if the arguments expanded properly, it still says that it requires an integer argument, but</p>

<pre><code>(first$ ?n)
</code></pre>

<p>does not evaluate to an integer.</p>

<p>My question is:
How can I take a value of a list of values and "parse" it as an integer?
Second of all, how can I expand these values to make them arguments of (&lt;) and tell if the list is in ascending order?</p>