Not really. In _Let Over Lambda_'s section on reader macros, he
creates a reader macro #`(foo bar a1 a2) that expands to (lambda (a1
a2) `(foo bar ,a1 ,a2)), but this is not possible in Clojure. A nice
example of something you can do with reader macros, in case Clojure
ever gets them.

And you could certainly write it yourself as a regular macro, at the
expense of a syntax that's almost as long as the (fn [x] `(foo))
syntax. But really, that construct is very short, and worrying about
the extra six characters you would save by writing it with #() seems
like wasted effort to me.

On Oct 19, 1:14 pm, Razvan Rotaru <razvan.rot...@gmail.com> wrote:
> Hi,
>
> I'm just wondering is there a nicer way to write this:
>
> (defmacro my-macro [& body]
>     (map (fn[x] `(my-fun ~x)) body))
>
> I'd like to use the anonymous function literall #(), but this won't
> work:
>
> (defmacro my-macro [& body]
>     (map #(`(my-fun ~%)) body))
>
> So if you have some suggestion, I'd be glad to hear it.
>
> Thanks,
> Razvan

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