"Jim - FooBar();" <jimpil1...@gmail.com> writes: > On 20/06/13 08:49, Phillip Lord wrote: >> Well, that doesn't answer the question. The backtick is useful in >> writing macros (although the situation this caused me grief, actually, I >> wasn't). So is quote. But then I do not understand why the behaviour is >> different between the two. > > However, whenever you do `(map ~f ~coll) what you really mean is > (clojure.core/map some-fn some-coll) and that is exactly what the > macro will expand to.
In my case, when I really meant was "(map somefn somecoll)" hence the confusion. > If you swap ` for ' then what you get is a list with a bunch of > non-qualified symbols in. Not very useful is it? It does depend on what you are doing. I was generating data that could be evaluated as code at some point. > Ambrose went a bit further and explained local-name capturing & gensym. Even > though automatic namespace qualification helps with that, it seems to be that > this is not the primary reason for it. Being able to generate code dynamically > without having to qualify every single symbol sounds more important to > me... You can do this either way. (defmacro remap3 [f & c] `(map ~f ~@c)) (defmacro remap4 [f & c] (list* 'map f c)) I haven't qualified map in either case, both still work. But, as Ambrose explanation shows, the former definition is better, because in the former it is clearer what environment the qualitification takes place. > hope this is clearer now... It is! Both the reasoning behind the problem and how to avoid it was causing me grief. Phil -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.