2011/1/8 Ken Wesson <[email protected]> > On Sat, Jan 8, 2011 at 12:33 PM, Stuart Halloway > <[email protected]> wrote: > > One goal of resource scopes [1] is to help with scoping activities at the > REPL. That said, I think this is a "ramping up" problem -- I rarely if ever > hit it anymore. > > > > Stu > > > > [1] http://dev.clojure.org/display/design/Resource+Scopes > > Eww. > > The more I think about it, the more I'm convinced that it's far > preferable to use a pure functional approach. Instead of fixing > > (defn foo [x] > (with-open [bar (baz x)] > (make-some-lazy-seq bar))) > > (map do-something-with (foo quux)) > > -> IOException: stream closed > > with "resource scopes", or even with > > (defn foo [x] > (with-open [bar (baz x)] > (doall (make-some-lazy-seq bar)))) > > (map do-something-with (foo quux)) > > isn't the truly functional way to use HOF like this? > > (defn foo [x processor] > (with-open [bar (baz x)] > (processor (make-some-lazy-seq bar)))) > > (foo quux #(map do-something-with %)) >
With the implicit assumption that your processor is not lazy itself ... > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected]<clojure%[email protected]> > 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
