Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-04 Thread Dale
>> This statement is ironic, considering the definition of a functional >> closure, after which Clojure is presumably named. > You're missing the point. A defn inside another defn doesn't do what you > think it does. defn always creates a global variable, even when it looks > like it should crea

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
Similarly, don't use def inside of a defn. Use let. On Tue, Aug 3, 2010 at 9:10 PM, Mark Engelberg wrote: > On Tue, Aug 3, 2010 at 1:06 PM, Dale wrote: > >> This statement is ironic, considering the definition of a functional >> closure, after which Clojure is presumably named. >> >> > You're m

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
On Tue, Aug 3, 2010 at 1:00 PM, Dale wrote: > On Aug 2, 11:07 pm, Mark Engelberg wrote: > > Can you distill this down to the smallest possible example that > demonstrates > > the error? > > Nope. Just spent some time trying to duplicate the nested function bug > in a simpler context. > > Well if

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Mark Engelberg
On Tue, Aug 3, 2010 at 1:06 PM, Dale wrote: > This statement is ironic, considering the definition of a functional > closure, after which Clojure is presumably named. > > You're missing the point. A defn inside another defn doesn't do what you think it does. defn always creates a global variabl

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Dale
On Aug 3, 11:26 am, Moritz Ulrich 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

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Dale
On Aug 2, 11:07 pm, Mark Engelberg wrote: > Can you distill this down to the smallest possible example that demonstrates > the error? Nope. Just spent some time trying to duplicate the nested function bug in a simpler context. A pointer to the place where I should deposit code that manifests a r

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-03 Thread Moritz Ulrich
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. On Tue, Aug 3, 2010 at 5:07 AM, Mark Engelberg

Re: bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-02 Thread Mark Engelberg
Can you distill this down to the smallest possible example that demonstrates the error? -- 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 - plea

bugs in with-local-vars and lexically-nested-function access to outer function parameters

2010-08-02 Thread Dale
In the program below, if I use the commented-out version of thsolve (program is the N queens puzzle), the with-local-vars construct causes a NullPointerException when its block exits, after appearingt o work correctly. The same thing happens if I use binding instead. The non-commented version of t