Re: Pattern matching question

*To*: mathgroup at yoda.physics.unc.edu*Subject*: Re: Pattern matching question*From*: Silvio Levy <levy at math.berkeley.edu>*Date*: Thu, 30 Jan 92 09:39:29 PST

Dan Dill notices that NonCommutativeMultiply[a_, b__, c_] := ... causes NonCommutativeMultiply[x,y,z,t] to match a->x, b->y, c->z**t. This is because NCM has the flat attribute, so Mathematica feels free to try to group the arguments any old way in order to obtain a match. So the match above is legal, and happens to be the first one encountered. Of course the match a->x, b->(y,z), c->t (the one he wants) would also be legal. To avoid the wrong match, say ClearAttributes[NCM,Flat]. Silvio