Online Algebra Calculator
Many of users do not use powerful Maxima computer algebra system for systematic work, but for ad hoc algebraic calculations – equations, functions, matrixes, etc. only. To do this job, it is not useful to download the whole application from a web site.
Function: macroexpand (<expr>) Returns the macro expansion of <expr> without evaluating it, when expr is a macro function call. Otherwise, macroexpand returns <expr>.
![Macroexpand Example gensym();
f(l, x) ::= buildq([l : l, x : x, z : abad9987629%],sublist_indices(l, lambda([z], z = x)));
f([x,y,z],a);
f([x,y,z],x);
macroexpand(f([x,y,z],a));
macroexpand(f([x,y,z],x));](http://maxima-online.org//plot.html?g=i-1143217987.png&t=img&db=r-1234532287)
If the expansion of <expr> yields another macro function call, that macro function call is also expanded.
macroexpand quotes its argument. However, if the expansion of a macro function call has side effects, those side effects are executed.
See also ::=, macros, and macroexpand1.
Examples
(%i1) g (x) ::= x / 99;
x
(%o1) g(x) ::= --
99
(%i2) h (x) ::= buildq ([x], g (x - a));
(%o2) h(x) ::= buildq([x], g(x - a))
(%i3) a: 1234;
(%o3) 1234
(%i4) macroexpand (h (y));
y - a
(%o4) -----
99
(%i5) h (y);
y - 1234
(%o5) --------
99 There are also some inexact matches for macroexpand. Try ?? macroexpand to see them.
(%o1) true (%i2)