From: Thomas A. Russ on
Tamas K Papp <tkpapp(a)gmail.com> writes:

Nice rewrite.

> (defparameter *op-table*
> '((+ "sum")
> (* "product")
> (- "difference")))
>
> (defun ask-what-is (op arg1 arg2)
> (format t "~&What is the ~a of ~a and ~a? "
> (second (assoc op *op-table*)) arg1 arg2)
> (let* ((result (funcall op arg1 arg2))
> (answer (read))
> (correct-p (= answer result)))
> (if correct-p
> (format t "~&Correct.")
> (format t "~&Nope. The correct is ~a." result))
> correct-p))

Or if you don't mind some fancier format string:

(format t "~&~:[Nope. The correct answer is ~a.~;Correct~*~]"
correct-p result)

--
Thomas A. Russ, USC/Information Sciences Institute