title: Common Lisp - type checking two variables
body: <p>Hi I'm a beginner in Common Lisp. I want to check if  two variables are integers. If both n and m are integers I want to it to return <code>-</code> if it is negative, <code>0</code> if it is zero, <code>+</code> if it is positive and <code>NIL</code> if it is not an integer for both n and m. I figured out how to do this with one variable but I can't seem to figure out how to do it with two variables. Thanks.</p>
  
  <p>This is the code that takes a numeric argument and returns <code>-</code> if it is negative, <code>0</code> if it is zero, <code>+</code> if it is positive and <code>NIL</code> if its not an integer:</p>
  
  <pre><code>(defun sign (n)
   (if(typep n 'integer)
      (cond ((&lt; n 0) '-)
            ((= n 0) 0)
            ((&gt; n 0) '+))))
  </code></pre>
  
  <p>The output for each case is:</p>
  
  <pre><code>CL-USER&gt; (sign 3) 
  
  +
  
  CL-USER&gt; (sign -3) 
  
  -
  
  CL-USER&gt; (sign 0) 
  
  0
  
  CL-USER&gt; (sign 3.3)
  
  NIL
  </code></pre>
  
  <p>This is the code I have for checking two variables which I want it to check if n and m are integers and if n and m are positive, negative or a zero:</p>
  
  <pre><code>(defun sign (n m)
   (if (and (typep n 'integer) (typep m 'integer))
    (cond (and ((&lt; n 0) '-) ((&lt; m 0) '-))
          (and ((= n 0) 0) ((= m 0) 0))
          (and ((&gt; n 0) '+) ((&gt; m 0) '+)) ))))
  </code></pre>