MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matching on Arguments of Flat Functions ...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29589] Re: Matching on Arguments of Flat Functions ...
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 27 Jun 2001 05:12:24 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9h8m6q$qsp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

that's a bug. But you may see whats happen with

MatchQ[f[1, 2], f[l_, r___] /; (Print[l]; IntegerQ[l])]

With the attribute flat the l_ is bound to f[2] because
f[f[1]] is f[1] (flat) and your Integer head does not match
any more.

You should report it to WRI!

Regards
  Jens 


Detlef Mueller wrote:
> 
> Little Session:
> 
> "
> In[1]:= MatchQ[f[1, 2], f[l_Integer, r___]]
> Out[1]= True
> 
> In[2]:= SetAttributes[f, Flat]
> 
> In[3]:= MatchQ[f[1, 2], f[l_Integer, r___]]
> Out[3]=False
> "
> 
> Oops! What happens here?
> I heard, that this Attribute may influence
> Matching - but I don't see, why something
> matched before now doesnt match anymore.


  • Prev by Date: Re: PS.
  • Next by Date: Re: Equations
  • Previous by thread: Matching on Arguments of Flat Functions ...
  • Next by thread: Making a LIst Reconsidered