I'm having problems with the following macro:
(defmacro gather-params (&rest body)
"Return plist of params"
`(concatenate 'list
(map 'list
#'(lambda (plist)
(if (typep (first plist) 'keyword)
(cons 'list plist)
plist))
',body)))
Within the macro, I can't make plist evaluate by adding a comma in front of it, e.g: ,plist when I do that, the compiler complains that the variable ,plist does not exist.
Is there something I'm not understand about the scope within a macro?
Current result:
input: (gather-params (:mykey (+ 1 1)) (list 1 2 3))
result: ((LIST :MYKEY (+ 1 1)) (LIST 1 2 3))
Desired result:
input: (gather-params (:mykey (+ 1 1)) (list 1 2 3))
result: ((LIST :MYKEY 2) (LIST 1 2 3))