On Nov 20, 1:58 pm, Rock <[EMAIL PROTECTED]> wrote:
> 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
I'm new to macros as well. Can you please explain when this would be
useful? How is it different from the auto-gensym that the reader
provides ( foo#)?
Allen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---