How can I lexically bind names like "let" does in a macro, when names
and values for those bindings are passed in?

This here works fine when I pass a literal collection:

(defmacro let-coll
  [coll & body]
  `(let ~(vec coll) ~...@body))

user=> (let-coll [a 11 b 22] (list b a))
(22 11)

Doing the same with a var doesn't work though:

user=> (def x ['a 11 'b 22])
#'user/x
user=> (let-coll x (list b a))
java.lang.Exception: Unable to convert: class clojure.lang.Symbol to
Object[] (NO_SOURCE_FILE:0)

Any ideas?

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