>> Which is of course what the quote is supposed to do. But is there any
>> way to get that macro to expand to using the value of asdf, rather
>> than the symbol itself? Or can only changing the macro fix this? I
>> fear the latter, which would imply that using quotes like that in a
>> macro should be done with great care, I guess. Adding a quote when
>> 'calling' the macro is easy...
>
> Why not just ~x rather than '~x? If you want the param evaluated, you
> normally just unquote it with ~.

Because Eugen is trying to use an existing macro in a different way
than it was originally intended, without changing the original macro.

This makes me think that the original macro needs some refactoring.
There should be a function that handles most of the work, and a macro
to make your code shorter in the common case.

(defn unquoted-param [x] (println x))

(defmacro quoted-param [x] `(unquoted-param '~x))

Of course, this looks silly because unquoted-param is just println,
but I assume your real situation has a bit more to it. In general, you
should try to use functions more often macros. Even when a macro is
needed, it's still often best to let a function do most of the work.

-- 
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

Reply via email to