On Aug 3, 11:26 am, Moritz Ulrich <ulrich.mor...@googlemail.com> wrote: > Defining function (with defn) inside another function isn't very > beautiful (def* outside of the top-level is generally disregarded). It > looks like you use thhelp only inside the thsolve-function. Use either > letfn or (let [thhelp (fn ....)] ...) here.
This statement is ironic, considering the definition of a functional closure, after which Clojure is presumably named. >From http://en.wikipedia.org/wiki/Closure_%28computer_science%29 "In some languages, a closure may occur when a function is defined within another function, and the inner function refers to local variables of the outer function. At runtime, when the outer function executes, a closure is formed, consisting of the inner function’s code and references to any variables of the outer function required by the closure; such variables are called the upvalues of the closure." I haven't had an application for returning closures as first class objects (yet), but presumably, if Clojure supports first-class functions (see http://clojure.org/functional_programming) and allows nested function definitions with lexical scope, then it supports closures. -- 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