title: Replacing symbols in a (nested)? List in LISP
body: <p>I am supplying a list in the following format:</p>
  
  <pre><code>(test '((Q H)(A D)(J C)(Q S)(3 S)))
  </code></pre>
  
  <p>The aim is to to search through the list and replace the symbols J Q K and A with the respective numbers 11 12 13 and 14. Currently my function is this (I'm sorry):</p>
  
  <pre><code>    (defun test (hand)
    (cond ((equal (first (first hand)) 'J)
           (setf (first (first hand)) '11))
          ((equal (first (first hand)) 'Q)
           (setf (first (first hand)) '12))
          ((equal (first (first hand)) 'K)
           (setf (first (first hand)) '13))
          ((equal (first (first hand)) 'A)
           (setf (first (first hand)) '14))
          (t (print '(It's ogre now))))
    (cond ((equal (first (second hand)) 'J)
           (setf (first (second hand)) '11))
          ((equal (first (second hand)) 'Q)
           (setf (first (second hand)) '12))
          ((equal (first (second hand)) 'K)
           (setf (first (second hand)) '13))
          ((equal (first (second hand)) 'A)
           (setf (first (second hand)) '14))
          (t (print '(It's ogre now))))
    (cond ((equal (first (third hand)) 'J)
           (setf (first (third hand)) '11))
          ((equal (first (third hand)) 'Q)
           (setf (first (third hand)) '12))
          ((equal (first (third hand)) 'K)
           (setf (first (third hand)) '13))
          ((equal (first (third hand)) 'A)
           (setf (first (third hand)) '14))
          (t (print '(It's ogre now))))
    (cond ((equal (first (fourth hand)) 'J)
           (setf (first (fourth hand)) '11))
          ((equal (first (fourth hand)) 'Q)
           (setf (first (fourth hand)) '12))
          ((equal (first (fourth hand)) 'K)
           (setf (first (fourth hand)) '13))
          ((equal (first (fourth hand)) 'A)
           (setf (first (fourth hand)) '14))
          (t (print '(It's ogre now))))
    (cond ((equal (first (fifth hand)) 'J)
           (setf (first (fifth hand)) '11))
          ((equal (first (fifth hand)) 'Q)
           (setf (first (fifth hand)) '12))
          ((equal (first (fifth hand)) 'K)
           (setf (first (fifth hand)) '13))
          ((equal (first (fifth hand)) 'A)
           (setf (first (fifth hand)) '14))
           (t (print '(It's ogre now))))
    (print hand))
  </code></pre>
  
  <p>I am certain there is a cleaner way of doing this. Could anyone point me in the right direction?</p>