Simplifying functions in Maxima code



-----maxima-bounces at math.utexas.edu wrote: -----

>I have now written a little experimental package which allows you to write
>simplifiers in Maxima code.  For example, here is some basic code for a
>simplifying absolute value function called aabs.

Cool. Here is a simplifying push; it amused me:

(%i2) load(basic)$
(%i3) simplifying('spush, lambda([x,l], if listp(l) then push(x,l) else
simpfuncall('spush,x, l)))$

(%i4) spush(a,b);
(%o4) spush(a,b)

(%i5) subst([1],b,%);
(%o5) [a,1]

(%i6) spush(a, spush(b, spush(c, d)));
(%o6) spush(a,spush(b,spush(c,d)))
(%i7) subst([1],b,%);
(%o7) spush(a,spush([1],spush(c,d)))
(%i8) subst(2,c,%);
(%o8) spush(a,spush([1],spush(2,d)))

Finally, do d -> []

(%i9) subst([],d,%);
(%o9) [a,[1],2]

Thanks for this contribution.

Barton