I have many functions of the same long signature (shortened here for simplicity):
(defn f
[x & {:keys [a b c d e f g h]
:or [a false b false c false d false e false f false g false h false]}]
a)
I was hoping to use a macro, function, or even a def to store this common signature beforehand:
(def args `[a b c d e f g h])
(defn args [] `[a b c d e f g h])
(defmacro args [] `[a b c d e f g h])
but all of them, when I plugged into
(defn f
[x & {:keys (args)
:or [a false b false c false d false e false f false g false h false]}]
a)
ended up with errors like
CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:1)
So my two questions are:
Is there any way to define and use such a common
args
?If such an
args
can be defined, I would also like to reduce it in order to get the:or
params:[a false b false c false d false e false f false g false h false]
. How would this be done? (I'm asking in case a working definition ofargs
might be weird enough that this is no longer straightforward.)