On Wed, Jan 28, 2009 at 12:10 AM, .Bill Smith <[email protected]> wrote:
>
> I'm trying to write a helper macro for invoking a class's main.
> Here's the macro:
>
> (defmacro main [class & args]
> #^{:doc "Invoke class's main with specified arguments, which are
> automatically stringified"}
> (if (= (count args) 0)
> `(. ~class main (make-array String 0))
> `(. ~class main (into-array (map str '~args)))))
This doesn't answer your question, but the way you're trying to add a
doc string is wrong:
user=> (defmacro main [] #^{:doc "doc string"})
java.lang.Exception: Unmatched delimiter: )
user=> (defmacro main [] #^{:doc "doc string"} 'something)
#'user/main
user=> (doc main)
-------------------------
user/main
([])
Macro
nil
nil
This is how you should do it:
user=> (defmacro main "doc string" [])
#'user/main
user=> (doc main)
-------------------------
user/main
([])
Macro
doc string
nil
--
Michael Wood <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---