Interpolation function



> > I find the following idiom to be easy to use and reliable:
> >     (%i1) make_inc(x) := buildq([x], lambda([y], x+y)) $
> Another fantastic bit of stuff that desperately needs to go into a howto book.

My first reaction to using buildq like this is revulsion, a sense that
a poor hack is being passed off as a standard programming technique. 
But then I stop a second and try to analyze why.

Well, the first reason is I suppose aesthetic: that this is the 'wrong
way'; the right way would be true lexical scoping (but that has lots
of difficulties in the Maxima context, which have been discussed
before).  So perhaps that is not such a good reason.

Another reason is that as a general rule, it is a bad idea to use
strong mechanisms when weaker ones will do. Buildq is intended for
building code within macros, not for simply substituting values.  To
substitute values, why not just use subst(x,'x,...) or, better,
sublis(['x=x,...],...)?

Finally, neither buildq nor subst really 'understands' what it is
doing, so nested bound variables will blindly be substituted as well,
e.g.

           sublis(['x=1], '( integrate(x^a,x,0,1) ) ) => 
integrate(1,1,0,1) !!!!????

I suppose this is no big deal if the object you're substituting in is
under your control.

So overall, I suppose I back off from my initial reaction of
revulsion, to a reaction of disappointment that we (i.e. Maxima) can't
do better....  I'd still recommend sublis rather than buildq, though.

            -s