thanks Ken Sunil On Thu, Nov 25, 2010 at 11:41 AM, Ken Wesson <kwess...@gmail.com> wrote:
> On Thu, Nov 25, 2010 at 1:06 AM, Sunil S Nandihalli > <sunil.nandiha...@gmail.com> wrote: > > Hello everybody, > > Is there a function which can tell me if a particular symbol was > generated > > by gensym or was present in the code? > > Sunil. > > I don't think so. > > On the other hand: > > (def my-gensyms (atom #{})) > > (defn my-gensym > ([] > (let [s (gensym)] > (swap! my-gensyms conj s) > s)) > ([prefix] > (let [s (gensym prefix)] > (swap! my-gensyms conj s) > s))) > > (defn is-my-gensym? [s] > (contains? @my-gensyms s)) > > will let you create gensyms with my-gensym and later check is a symbol > was created with is-my-gensym?. > > Warning: a hashset grows in memory for every gensym created with my-gensym. > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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