I've done my best to get a good enough grasp of how macros and syntax-
quotes work in Clojure. While waiting for some more detailed
documentation (thanks Meikel), I thought I'd work on something
practical. Here's my attempt at writing a version of WITH-GENSYMS for
Clojure, taken directly from Peter Seibel's Practical Common Lisp:

(defmacro with-gensyms [[& names] form]
  `(let ~(apply vector (loop [n names result []]
                         (if (nil? n)
                           result
                           (recur (rest n)
                                  (conj result (first n) `(gensym))))))
     ~form))

Tried it out with macroexpand and it seems to work fine. Let me know
what you all think. Perhaps something like with-gensyms could be
included directly in the core lanuage. I've always thought that it
should have been included in Common Lisp, given that it is employed so
frequently.

Rock

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to