[Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized.
macrakis at alum.mit.edu
Tue Jan 2 10:41:01 CST 2007
On 1/2/07, Michel Van den Bergh <michel.vandenbergh at uhasselt.be> wrote:
> To avoid confusion I would like to stress again that the issue with my
> example is not related to quotation.
I understand. I was replying to a post suggesting f('x):=.
> Something like Richard's sanitize (suitably extended) which would replace parameters
> and local block variables (and probably the dummy variables in lambda expression as well) by ?gensym()'s
> would go a long way to emulating lexical scope I think.
Off the top of my head, there are three issues with "sanitize":
-- how to make it efficient
-- how to make functions display reasonably
-- handling quoted material which happens to contain symbols with
the same name as variables (e.g. f(x):= 'x )
Surely, the substitution of gensyms shouldn't happen at every
evaluation of the function. On the other hand, when you dispfun the
function or write it out to disk, you shouldn't see gensyms in the
result. Writing the necessary caching code is pretty trivial, but yet
another layer of messiness.
More information about the Maxima