title: Specifying the type of keyword arguments in Common Lisp methods
body: <p>I thought i could define a method which accepts keyword arguments. But when i have multiple methods with keyword arguments of different types, it seems that lisp uses the last evaluated method. For example below:</p>
  
  <pre><code>(defmethod f (&amp;key (x list)) (make-list 3 :initial-element (first x)))
  (defmethod f (&amp;key (x number)) (* 2 x))
  </code></pre>
  
  <p>Now <code>f</code>'s <code>:x</code> accepts only numbers and throws errors for lists:</p>
  
  <pre><code>(f :x 2)                ;4
  </code></pre>
  
  <p>but</p>
  
  <pre><code>(f :x '(2))
  </code></pre>
  
  <blockquote>
    <p>The value (2) is not of type NUMBER when binding SB-KERNEL::X [Condition of type TYPE-ERROR]</p>
  </blockquote>
  
  <p>How can i define multiple methods with &amp;key args of different types?</p>