Hello,

Is it theoretical, or do you have a concrete use case we could try to help
you with ?


2009/2/7 samppi <rbysam...@gmail.com>

>
> Let's say I have a macro:
>
> (defmacro foo [& args] ...)
>
> I want to do something equivalent to this:
> (defn bar-fn [factor arg]
>  (apply foo (replicate factor arg)))
>
> ...but since I can't take values of macros, I have to do something
> like this, right?
>
> (defmacro bar [factor arg]
>  `(foo ~@(replicate factor arg)))
>
> ...but then when I use it I get a ClassCastException if I try to do
> something like (bar (dec 5) something), because then Clojure tries to
> evaluate (replicate '(dec 5) 'something).
>
> So how should I rewrite bar to behave like bar-fn, then?
>
>
> >
>


-- 
Cordialement,

Laurent PETIT

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