2006-12-24 00:10:41 UTC
working through Practical common lisp. Everything working OK until I start
on the test framework.
What I've typed looks like
(defmacro combine-results (&body forms)
`(let ((,result t))
,@(loop for f in forms collect `(unless ,f (setf ,result nil)))
(defmacro check (&body forms)
,@(loop for f in forms collect `(report-result ,f ',f))))
(defun report-result (result form)
(format t "~:[FAIL~;pass~] ... ~a~%" result form)
(defun test-+ ()
(= (+ 1 2) 3)
(= (+ 1 2 3) 6)
(= (+ -1 -3) -4)))
Which I'm pretty sure is correct, upto the point I've reached.
I'm using Cormon lisp, because I've found I 'get it' and emacs/slime doesn't
work for me (which isn't to say I can't get it to work, it does work just
fine, I just prefer corman lisp, so far).
Cormon lisp jacks up about the 'with-gensysms' call. Which results in
'result' being unbound and then of course, nothing works. A quick google
shows that maybe 'with-unique-names' might be a better choice, but that did
the same thing. So, what am I doing wrong here?