Re: MatchQ, silly question
- To: mathgroup at smc.vnet.net
- Subject: [mg105114] Re: MatchQ, silly question
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Sat, 21 Nov 2009 03:35:07 -0500 (EST)
- References: <he5v9i$3gh$1@smc.vnet.net>
janos wrote:
> MatchQ[3 x^2, #] & /@ {3 x_^2, 3 x_^_, _ x_^_, _ _^_, _ (_^_), _ *
> (_^_)}
>
> dives False in the last cases. Why? The FullForm
>
> Power[Blank[ ],Plus[1,Blank[ ]]]
>
> contains Plus, why?
>
> Thank you.
>
> J=E1nos
>
Because expressions still evaluate, even if they contain Blank[] - this
can be easily seen by entering the expression _+_ .
Wrap the pattern in HoldPattern to prevent evaluation.
David Bailey
http://www.dbaileyconsultancy.co.uk