On Tue, Jan 20, 2009 at 3:54 PM, Hugh Winkler <hwink...@gmail.com> wrote: > On Tue, Jan 20, 2009 at 3:06 PM, Stuart Halloway > <stuart.hallo...@gmail.com> wrote: >> >> Hi Hugh, >> >> I don't see how this would work in general, which is why a I suggested >> a special-purpose macro before. Surely you would not want a binding to >> force all sequences while that binding is in effect. And if not that, >> what would the general strategy be for deciding which sequences to >> force, and which not? > > > OK, well keeping in mind I'm still learning: > > I agree a macro would do it, approximately this: > > (defmacro safe-binding [bindings & body] > `(binding ~bindings (doall ~...@body))) > > > but why not make "safe" the default? i.e. use "unsafe-binding" if > you know it's OK. > > The doall just forces the result of the function you're calling, > right? You said "Surely you would not want a binding to force all > sequences while that binding is in effect." No, I would not. You only > need to do wrap the body of the binding call in the doall, right? >
Uh oh, I see what you mean Stuart. I made f1 return a list of lists: (defn f1 [] ( map (fn [x] (map (fn [y] *num*) [x])) [1])) user> (safe-binding [*num* 1024] (f1)) ((16)) OK, so much for the magic bullet. Hugh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---