I'm trying to create a macro (bar
) that should be used like this:
(let ((my-var "foo"))
(bar ("some")
:buzz (lambda () (format t "~a~%" my-var))))
The macro should basically just FUNCALL the lambda with taking MY-VAR into account.
What I've come up with is this:
(defmacro bar ((thing) &body body)
`(funcall (coerce (getf (list ,@body) :buzz) 'function)))
This works, it prints "foo". But I'd like to know if this is how this is done or if there is a better way of doing this.