Subject: Pattern of (aa+nn*bb), matchdeclare, defmatch
From: Rhys Pratt
Date: Wed, 24 Nov 2010 10:36:44 +0800
On Tue, 23 Nov 2010 07:59:54 -0800
Richard Fateman <fateman at cs.berkeley.edu> wrote:
>Maybe you should describe your pattern better.
Thanks for the reminder. I want to design such a pattern, a non-numeric component (or a symbol) plus another form "constant * symbol ". In other words, I want to extract a, b, n in the form of "a+n*b" which contains constant n.
(%i1) matchdeclare([aa, bb], all, nn, numberp);
(%o1) done
(%i2) defmatch(m1, aa+nn*bb);
defmatch: nn*bb will be matched uniquely since sub-parts would otherwise be ambigious.
(%o2) m1
I don't know how to define the aa and bb to eliminate the error message in step %i2