Re: Pattern matching help
- To: mathgroup at smc.vnet.net
- Subject: [mg119273] Re: Pattern matching help
- From: Armand Tamzarian <mike.honeychurch at gmail.com>
- Date: Sat, 28 May 2011 07:19:29 -0400 (EDT)
- References: <irntgn$som$1@smc.vnet.net>
On May 27, 8:13 pm, Chuck <chuck.can... at gmail.com> wrote: > I've been using Mathematica for a long time now but have always been a > bit frustrated with understanding the pattern matching syntax. > > I noticed in the current thread about Position, where DrMajorBob > explains the difference between testing and pattern matching, that I > had never come across the syntax for testing before. > > I have searched many times through the years for a clear explanation > about how to use the various testing and matching patterns but I have > never found one. The help files in Mathematica are typically quite > helpful, if occasionally cryptic, but this one aspect has completely > stumped me for years. > > I would like to improve my jinky little tricks that I use and make > full use of this feature. > > Have I missed something obvious somewhere? Can someone point me to a > clear explanation of how to use these various tests and matches? > > Thanks, > Chuck Chuck, these two "forms" that you saw in the answers are conditions and pattern tests. Have a look through these sections of the documentation, particularly the tutorial. ref/PatternTest ref/Condition tutorial/PuttingConstraintsOnPatterns Mike