I'm a little unclear on why this happens still. #(= % a) is a closure, correct? My understanding is that this should capture the environment when it is defined. Why does "the environment" not include the current bindings?
-- Aaron On Tue, Jul 14, 2009 at 4:03 PM, Mark Engelberg <mark.engelb...@gmail.com>wrote: > > On Tue, Jul 14, 2009 at 12:40 PM, Jarkko Oranen<chous...@gmail.com> wrote: > > This is a common gotcha. It's actually a laziness issue: the seq > > produced by filter is realised only after it exits the binding scope, > > thus producing '(1). You need to use "doall" to force the seq if you > > want the binding to apply. > > Yeah, but more and more I'm finding that with complex code, it can be > rather difficult to identify the parts that are lazy and the parts > that aren't. Which makes using binding rather risky. I've started to > refactor most of my code to avoid dynamic binding, because I'm tired > of getting burned by this gotcha. Which is a shame. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---