title: How do I write a macro-defining macro in common lisp
body: <p>I have about two macros (and climbing) in my codebase that look like this:</p>
  
  <pre><code>(defmacro def-stat-method (method-name stat)
    `(progn
       (defmethod ,method-name ((monster monster))
         (getf (stats monster) ,stat))
       (defmethod (setf ,method-name) (value (monster monster))
         (setf (getf (stats monster) ,stat) value))))
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>(defmacro def-energy-method (method-name stat)
    `(progn
       (defmethod ,method-name ((monster monster))
         (getf (energies monster) ,stat))
       (defmethod (setf ,method-name) (value (monster monster))
         (setf (getf (energies monster) ,stat) value))))
  </code></pre>
  
  <p>Each of the macros has the following calling syntax: <code>(def-stat-method ranged-weapon :ranged-weapon)</code></p>
  
  <p>I would like a macro <code>(def-foo-method macro-name method)</code> that expands into the appropriate macros so that <code>(def-foo-method def-stat-method stats)</code> expands into the first example above. I am a lisp newbie and don't really know how to do this. All help appreciated.</p>