Hi.

I'm trying to understand why the following macro doesn't work.  This is a
trivial example, but ultimately I want to create a macro that will let me
dynamically create the cmdspec for
clojure.contrib.command-line/with-command-line.  I haven't written many
macros, so my general understanding may be off.

user> (use 'clojure.contrib.command-line)
user> (def args ["--foo" "2"])
user> (defmacro my-with-cl [spec] `(with-command-line args "desc" ~spec (prn
foo)))
user> (my-with-cl '[[foo "something about foo" nil]])
; Evaluation aborted.
Exception: Unsupported binding form: something about foo

I would expect this to be expanded to
  (with-command-line args "desc" [[foo "a" "b"]] (prn foo))

Which runs ok, directly in the repl:
user> (with-command-line args "desc" [[foo "a" "b"]] (prn foo))
"2"
nil

And (macroexpand (my-with-cl ...)) throws the same exception.

How can I accomplish this, and why does my solution not work?

Thanks for any help.
Marc

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