Re: Why does MemberQ[{0,1,2}, expr_] evaluate to True?
- To: mathgroup at smc.vnet.net
- Subject: [mg125930] Re: Why does MemberQ[{0,1,2}, expr_] evaluate to True?
- From: David Reiss <dbreiss at gmail.com>
- Date: Sat, 7 Apr 2012 05:59:25 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <4F7D8716.4010202@fundp.ac.be> <jlmf8n$mhn$1@smc.vnet.net>
expr_ is a pattern that matches any expression. Hence it matches at least one of the members of the list {0,1,2}. --David On Apr 6, 6:07 am, Christoph Lhotka <christoph.lho... at fundp.ac.be> wrote: > I am really sorry for reposting it but of course the subject of > discussion should be: > > MemberQ[{0, 1, 2}, expr_] > > Please replace below and in message ModuleQ by MemberQ. > > best, > > christoph > > On 04/05/2012 01:50 PM, Christoph Lhotka wrote: > > > > > > > > > Hello, > > > I found and interesting subject of discussion in the post > > > "Bug in pattern test, or I did something wrong?" > > > I could trace back the problem to an issue with ModuleQ. > > > Question: Why does > > > In[12]:= ModuleQ[{0,1,2},expr_] > > > Out[12]:= True > > > evaluate to True? > > > My argumentation is as follows: > > > On the one hand there could be a chance that expr_ is 0,1 or 2 but on > > the other > > hand the probability that expr_ is not 0,1 or 2 is even higher. As a > > conclusion it should neither > > evaluate to True nor to False. > > > In other words: Is there any reason why the expression of everything > > (named expr) > > is contained in the set {0,1,2} ? > > > Best, > > > Christoph