On Oct 2, 12:47 pm, b2m <b2monl...@googlemail.com> wrote:
>
> But all the arguments are in a list e.g. (def arglist '(true false
> true false))
>
> Is there a simple way to 'apply' the macro to a list of arguments like
> it works for functions: (apply + '(1 2 3)) ?
>
Yes. You build up the code/data structure and pass it to either
`eval' or `macroexpand', depending on your exact goals...
user=> (def args '(true false true false))
#'user/args
user=> (def code `(and ~...@args))
#'user/code
user=> code
(clojure.core/and true false true false)
user=> (eval code)
false
user=> (macroexpand code)
(let* [and__3981__auto__ true] (if and__3981__auto__ (clojure.core/and
false true false) and__3981__auto__))
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---