Hi On Tue, Jan 20, 2009 at 7:01 AM, Stuart Halloway <stuart.hallo...@gmail.com> wrote: > > Lazy evaluation is a harsh mistress. > > user=> (def b1 (binding [*num* 1024] (f1))) > #'user/b1 > user=> (def b2 (binding [*num* 1024] (f1))) > #'user/b2
Did you mean b1 and b2 to have the same definition? If so, I don't understand what you are trying to demonstrate by doing that. > user=> b1 > (16) > user=> b2 > (16) > > The difference between the example above and your example is the > interaction with the REPL. Your f1 is lazy, and is not realized until > outside the binding, when the REPL needs it. Your f2, also lazy, is > realized inside the binding because of the call to first. I thought this stuff was supposed to be easier to reason about! :) Would it perhaps make sense to save the environment that f1 was called in and use that during the realisation of its result? That would seem to be far more sensible, but maybe there's a reason it would not work. How would one go about fixing f1 (or b1)? -- Michael Wood <esiot...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---