find_root and variable capture?



On Fri, Mar 7, 2008 at 2:29 PM, dlakelan <dlakelan at street-artists.org> wrote:
>  I went through my entire script, and converted things like
>  find_root(foo(bar,baz,quux),[bar,0,1]) into
>  find_root(funmake('foo,['bar,baz,quux]),['bar,0,1])
>  which seems to have solved some problems, and now my script can plot2d
>  my function.

Glad to hear it!

I don't think, though, that you should have to write

    find_root(funmake('foo,['bar,baz,quux]),['bar,0,1])

I would think that

   find_root('(foo(bar,baz,quux)),['bar,0,1])

would work as well since foo(bar,baz,quux) will be evaluated in a
context where baz and quux are still bound to the correct values.  It
would be different if you were *returning* the expression to an outer
level.  Or if there is a true variable capture problem, that is,
interference between the internal variable names of find_root and baz
and quux. In that case, the problem should be fixed by changing
find_root's variable names to, e.g. fr_bar, fr_baz, etc. (yes, it
would be better to have static scope, but...)

           -s