Re: MatchQ, silly question
- To: mathgroup at smc.vnet.net
- Subject: [mg105129] Re: MatchQ, silly question
- From: janos <janostothmeister at gmail.com>
- Date: Sun, 22 Nov 2009 06:07:19 -0500 (EST)
- References: <he5v9i$3gh$1@smc.vnet.net> <he896k$q8g$1@smc.vnet.net>
Thank you for all, I learned from the answers :)!
J=E1nos
On Nov 21, 9:43 am, David Bailey <d... at removedbailey.co.uk> wrote:
> 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 Baileyhttp://www.dbaileyconsultancy.co.uk