Say there is a defmacro
defined like this:
(defmacro do-something (foo &optional bar)
(...))
And then there is another one that calls it:
(defmacro something-else (wat baz &optional bar)
(let ((foo (concat wat baz)))
(do-something ...)))
What is the best practice for calling do-something
from within
something-else
with the let variable foo
, and bar
only if it
exists as an argument passed into something-else
?
I know you could conditionally check the presence of bar
like so:
(if bar
(do-something foo bar)
(do-something foo))
Ideally I'm looking for some pattern where I can prepare a list of
argument variables and call do-something
once, with something like
(apply)
for macros, where a list variable can be turned into a
variable series of consecutive arguments. Or maybe I'm just thinking
about this in the wrong manner?
(when bar (do-something foo bar))
work?