Re: ! operator
- To: mathgroup at smc.vnet.net
- Subject: [mg55929] Re: [mg55927] ! operator
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 10 Apr 2005 23:07:05 -0400 (EDT)
- References: <200504101055.GAA29078@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 10 Apr 2005, at 19:55, DongGook Park wrote:
>
> Hi,
>
> Could you explain a mysterious behaviour of "! operator" as shown
> below?
>
>
> In[43]:=
> MemberQ[{1,2,3},3]
>
> Out[43]=
> True
>
> In[47]:=
> !MemberQ[{1,2,3},3]
> (* Here Mathematica does not give any response! *)
>
> In[48]:=
> Not@MemberQ[{1,2,3},3]
>
> Out[48]=
> False
>
>
> Considering the description from Mathematica help:
> "!expr is the logical NOT function. It gives False if expr is True,
> and True if it is False."
> This behaviour seems quite suspicious?
You stopped reading the help too early:
If you are using Mathematica with a text$B!>(Bbased front end, then you
cannot use the notation !expr for Not[expr] if it appears at the very
beginning of a line. In this case, !expr is interpreted as a shell
escape.
The only strange thing is this reference to "text$B!>(Bbased front end"
since this is also true for graphic front ends or at least Mac OS X.
However, everything works fine if you enclose ! in something, e.g.
parentheses
(!MemberQ[{1,2,3},3])
False
or
(!2>3)
True
Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/
- References:
- ! operator
- From: "DongGook Park" <dgpark6@sunchon.ac.kr>
- ! operator