From: Vijay M. <vij...@gm...> - 2013-08-11 07:27:12
|
I have the following macro definition which takes a symbol as argument and defines a new function. The symbol is used as the new function name: (defmacro make-fn (fn-name) `(defun ,fn-name () (format t "~a~%" ',fn-name))) The macro seems to work correctly: CL-USER> (make-fn my-function) MY-FUNCTION CL-USER> (my-function) MY-FUNCTION But when it is called from within the `dolist` macro a function with name `fn-name` is defined: (defparameter *fn-names* '(func01 func02)) (dolist (fn-name *fn-names*) (make-fn fn-name)) CL-USER> (func01) Error: FUNC02 is undefined. CL-USER> (fn-name) FN-NAME What is wrong with the macro definition? Thank you, --Vijay |