Re: Question on pattern matching
- To: mathgroup at smc.vnet.net
- Subject: [mg47791] Re: Question on pattern matching
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 27 Apr 2004 04:46:35 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <c6ibik$6fp$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Orderless mean not that Mathematica try all possible argument orderings, it mean that Mathematica can order the arguments in the way it likes it (OrderedQ[args]===True) Regards Jens Roman Green wrote: > > Hi, > > I am a very newbie in Mathematica so sorry for possibly stupid question. > > In the following Mathematica's output > In[1]:= SetAttributes[k, Orderless] > In[2]:= k[a, b, b] /. k[x_, x_, y_] -> 0 > Out[2]= 0 > In[3]:= k[a, b, b] /. k_[x_, x_, y_] -> 0 > Out[3]= k[a, b, b] > > I can't understand why Mathematica can find match when applying pattern > k[x_, x_, y_], but is unable with more general pattern k_[x_, x_, y_]. > > Thanks in advance. > > --- > > R. Green