Hi,
I want to experiment with rule-based programming in Maxima,
but I cannot understand the strange behavior of defmatch:
(%i1) matchdeclare([aa,bb],lambda([u],symbolp(u) or numberp(u)));
(%o1) done
(%i2) defmatch(addp,aa+bb);
(%o2) addp
(%i3) addp(x+1);
(%o3) [bb=x+1,aa=0]
Why is bb so greedy and receives x+1?
That is neither a symbol, nor a number.
I would expect to get aa=1 and bb=x (or vice versa).
matchdeclare([aa,bb],lambda([u],symbolp(u)))
and addp(x+y)
results always in "false", even when both summands
are symbols!
Is that a bug, just an insufficiency (restricting
rule-based programming in Maxima to very few cases)
or have I misunderstood something fundamental?
Thanks in advance for anwers or suggestions,
Wilhelm