don't use def inside functions, ever. in scheme define is lexically scoped, so you do that sort of thing. clojure is not scheme. if you want a lexically scoped function use a lexical scoping construct like let or letfn.
On Mon, Feb 8, 2010 at 12:12 PM, Brenton <bashw...@gmail.com> wrote: > What is the Clojure best practice, if there is one, for writing a > function like this: > > <pre> > (defn integral [integrand initial-value dt] > (def --integral (cons initial-value > (lazy-seq (add-streams (scale- > streams integrand dt) > > --integral)))) > --integral) > </pre> > > integrand is a stream of values. > > I don't like the fact that --integral is visible outside of the > integral function but I don't know how else to implement this > efficiently. I am using -- here as a naming convention to identify > vars that are defined within other functions. > > Also, what is general feeling about defs inside of functions? > > Brenton > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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