title: Rewrite loop as a mapcar
body: <p>Looking at <a href="http://www.gigamonkeys.com/book/practical-building-a-unit-test-framework.html" rel="nofollow">Practical Common Lisp</a>, we're looking at a simple automated unit test framework. We're trying to write a macro to be used as such:</p>
  
  <pre><code>(check (= (+ 1 2) 3) (= (- 1 4) 9))
  </code></pre>
  
  <p>This should expand to something using a previously defined function <code>report-result</code>. The suggested implementation is:</p>
  
  <pre><code>(defmacro check (&amp;body forms)
    `(progn
       ,@(loop for f in forms collect `(report-result ,f ',f))))
  </code></pre>
  
  <p>However, that expansion seems rather procedural to me. I wanted to replace the <code>loop</code> with a <code>mapcar</code> to expand to something like this:</p>
  
  <pre><code>(mapcar #'(lambda (form) (report-result form 'form)) (list form-1 ... form-n))
  </code></pre>
  
  <p>However, I'm clearly lacking the macro-writing skills to do so. Can someone come up with one such macro?</p>
  
  <p>In case it's relevant, this is the definition of <code>report-result</code>:</p>
  
  <pre><code>(defun report-result (result form)
    (format t "~:[FAIL~;pass~] ... ~a~%" result form))
  </code></pre>