On Wed, Jan 28, 2009 at 12:10 AM, .Bill Smith <william.m.sm...@gmail.com> 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 <esiot...@gmail.com>

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