in a (def f [] E), only a E is going to be macro-expanded. (I think
the rule of thumb is that macro are only expanded in a position
where an expression is.)

You can build :

(defmacro macro-expanding-defn [name l]


) using a combination of macro-expand, defn and macro?

(You can also do a simpler macro that uses functions returning terms
and not macros)

Best,

Nicolas.



On Sat, Sep 18, 2010 at 6:15 AM, Stuart Campbell <stu...@harto.org> wrote:
> Hello,
>
> In the following contrived example, I get an error when macroexpanding (defn
> foo ...):
>
> (defmanlyro special-fn-spec []
>   '([bar baz] (println bar baz)))
>
> (defn foo
>   ([bar] (foo bar :default))
>   (special-fn-spec))
>
> The error is:
> Parameter declaration special-fn-spec should be a vector
>   [Thrown class java.lang.IllegalArgumentException]
>
> I'm a bit confused about the order in which things are happening here. My
> assumption was that (special-fn-spec) would be evaluated before the fn
> definition. Is there a way to do something like this?
>
> Thanks
> Stuart
>
> --
> 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



-- 
Sent from an IBM Model M, 15 August 1989.

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