I was looking at the source code for sublis (defined in
src/sublis.lisp). It seems that much of the complexity of this code
could be eliminated by using the CL function sublis. Does the Maxima
sublis function predate the Common Lisp function sublis?
(1) sublis ignores opsubst, subst doesn't; sublis obeys the
sublis_apply_lambda option variable, subst ignores it,
(2) sublis requires a list of substitutions, subst doesn't,
(3) subst allows for substitutions of subscripted variables, sublis
doesn't,
(4) subst allows for substitutions of nonatoms, sublis doesn't (OK,
parallel substitution of say sublis([x*y=1, x = 7], x * y) is somewhat
problematic.)
In part, I was looking at all this because I was thinking about
substitutions into Maxima conditionals:
(%i6) '(if x < 1 then 5 else 1/x)$
(%i7) subst(x=0,%); Division by 0
In the new to_poly_solver (CVS only), there is a simplifying
conditional %if. I started thinking about squeezing some code into
sublis to make sublis work for conditionals, but the source for sublis is
recondite. Of course, it's tempting to take the easy path: ditch the
complexity (and the oddball option variable sublis_apply_lambda) and
start from scratch and use the CL function sublis. Already, subst and
sublis have too many differences...
Barton