It seems like the following macro would work as well: (defmacro load-string-here [string] (read-string string))
=> (let [a (fn [] "inside fn")] (load-string-here "(a)")) "inside fn" Jonathan On Tue, Jun 21, 2011 at 12:51 PM, Jonathan Fischer Friberg < odysso...@gmail.com> wrote: > Thanks, but I think I'll simply input the let in the string, i.e > > (load-string "(let [a (fn [] "inside fn")] (a))") > > But I still think it's odd behavior. I've always thought of eval as equal > to putting that code there. > > (eval '(a)) is equal to (a) > > Which I think would be much more intuitive. > > Jonathan > > > On Tue, Jun 21, 2011 at 2:49 AM, David Nolen <dnolen.li...@gmail.com>wrote: > >> On Mon, Jun 20, 2011 at 7:45 PM, Jonathan Fischer Friberg < >> odysso...@gmail.com> wrote: >> >>> I got a very nasty bug from this behavior today >>> >>> user=> (def a (fn [] "outside a")) >>> #'user/a >>> user=> (let [a (fn [] "inside a")] (load-string "(a)")) >>> "outside a" >>> user=> (let [a (fn [] "inside a")] (eval '(a))) >>> "outside a" >>> >>> Is this really how these functions should behave? >>> >>> Jonathan >>> >> >> Relevant previous threads: >> >> >> http://groups.google.com/group/clojure/browse_thread/thread/e1226810b6ac7bfc/8e0f53c141c26fcc >> >> http://groups.google.com/group/clojure/browse_thread/thread/ead8a3a8ff009a8f/17bb00a546724435 >> >> David >> >> -- >> 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 >> > > -- 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