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 create a

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-03 Thread Dale
On Aug 2, 11:07 pm, Mark Engelberg mark.engelb...@gmail.com 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

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 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

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 dpar...@ptd.net 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

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 dpar...@ptd.net wrote: On Aug 2, 11:07 pm, Mark Engelberg mark.engelb...@gmail.com 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

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 mark.engelb...@gmail.comwrote: On Tue, Aug 3, 2010 at 1:06 PM, Dale dpar...@ptd.net wrote: This statement is ironic, considering the definition of a functional closure, after which Clojure is

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

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 -